TF-1246: Enable FCM for Web browser
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
importScripts("https://www.gstatic.com/firebasejs/9.10.0/firebase-app-compat.js");
|
||||
importScripts("https://www.gstatic.com/firebasejs/9.10.0/firebase-messaging-compat.js");
|
||||
|
||||
firebase.initializeApp({
|
||||
apiKey: "...",
|
||||
authDomain: "...",
|
||||
databaseURL: "...",
|
||||
projectId: "...",
|
||||
storageBucket: "...",
|
||||
messagingSenderId: "...",
|
||||
appId: "...",
|
||||
});
|
||||
const messaging = firebase.messaging();
|
||||
@@ -56,6 +56,7 @@
|
||||
// Wait for registration to finish before dropping the <script> tag.
|
||||
// Otherwise, the browser will load the script multiple times,
|
||||
// potentially different versions.
|
||||
navigator.serviceWorker.register('firebase-messaging-sw.js');
|
||||
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
|
||||
navigator.serviceWorker.register(serviceWorkerUrl)
|
||||
.then((reg) => {
|
||||
|
||||
Reference in New Issue
Block a user