I\'d like to use the firebase cloud messaging service in my GWT webapplication, but I\'m stuck with some problems. The application should be able to register the firebase se
Not only a empty file, is a good idea to add the content like:
importScripts('https://www.gstatic.com/firebasejs/7.14.2/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/7.14.2/firebase-messaging.js');
/*Update this config*/
var config = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: ""
};
firebase.initializeApp(config);
const messaging = firebase.messaging();
messaging.setBackgroundMessageHandler(function(payload) {
console.log('[firebase-messaging-sw.js] Received background message ', payload);
// Customize notification here
const notificationTitle = payload.data.title;
const notificationOptions = {
body: payload.data.body,
icon: 'http://localhost/gcm-push/img/icon.png',
image: 'http://localhost/gcm-push/img/d.png'
};
return self.registration.showNotification(notificationTitle,
notificationOptions);
});
// [END background_handler]