-
Notifications
You must be signed in to change notification settings - Fork 0
/
firebase-messaging-sw.js
31 lines (26 loc) · 1.07 KB
/
firebase-messaging-sw.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
importScripts('https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/8.6.1/firebase-messaging.js');
// Your web app's Firebase configuration
const firebaseConfig = {
apiKey: "AIzaSyC4njacsC06CRlbeJ4oDtgzlHEAv6Wab_U",
authDomain: "ikseer-e68b7.firebaseapp.com",
projectId: "ikseer-e68b7",
storageBucket: "ikseer-e68b7.appspot.com",
messagingSenderId: "339514332634",
appId: "1:339514332634:web:e48f8e758db58e5a475ce3",
measurementId: "G-H83FPQZBC4"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
// Retrieve Firebase Messaging object.
const messaging = firebase.messaging();
messaging.onBackgroundMessage((payload) => {
console.log('[firebase-messaging-sw.js] Received background message ', payload);
// Customize notification here
const notificationTitle = payload.notification.title;
const notificationOptions = {
body: payload.notification.body,
icon: payload.notification.icon
};
self.registration.showNotification(notificationTitle, notificationOptions);
});