I'm setting up Firebase Cloud Messaging to do push notifications on the web. It works but only with Chrome (Windows and Android) and Firefox(Android) so far. It's not working on Samsung Internet Browser (the browser that comes pre-installed on Samsung's phones) and I haven't gotten a chance to test on iOS so far.
I've tried adding the sender id as gcm_sender_id
to the Cloud Function I'm using as well as to the manifest.json
file to no avail. Below is how the notification body is set up.
// Create notification content
const notification = admin.messaging().Notification = {
title : 'My test Title',
body : `Lorem Ipsum Dolor`,
};
const payload = admin.messaging().Message = {
notification,
webpush:{
notification : {
vibrate: [200, 100, 200],
icon: 'https://www.goodhousekeeping.com/life/pets/g4531/cutest-dog-breeds/', //A random dog photo
fcm_options: {
link: 'https://www.youtube.com',
gcm_sender_id : '<SENDER_ID>',
},
},
},
topic: '<TOPIC>'
};
//Send notification
return admin.messaging().send(payload);
Is there anything I can do to get this to work on Samsung Internet? Service Workers have been supported since v4 and the device has v9. It should be noted that even on the devices that receive it, when I click on it, it doesn't open up the website I set in fcm_options
nor does it follow the vibrate pattern but it does load the icon.
UPDATE: As of April 2020 FCM is completely incompatible with iOS Chrome and Safari
So I know this probably isn't helpful but it 'magically' started working today. The browser version is Samsung Internet v10.
firebase-messaging-sw.js
Cloud function to send notifications