iOS 12 has added critical alerts. The APNS payload has the sound dictionary to support critical alerts. Is there an equivalent sound dictionary support in FCM payload to send FCM notifications to iOS devices.
Critical alerts have now been added by firebase.
It can be added to the MessagingPayload like this:
const messagingPayload = {
token: this.FCMToken,
notification: {
...payload,
},
apns: {
payload: {
aps: {
criticalSound: {
critical: true,
name: 'default',
volume: 1.0,
},
},
},
},
};
return admin.messaging().send(messagingPayload);
The docs can be a little confusing. You have to use messaging().send() and encode the token in the payload, instead of using messaging().sendToDevice().
The payload message is a TokenMessage https://firebase.google.com/docs/reference/admin/node/admin.messaging.TokenMessage
p.s.
You also need to get an entitlement from Apple before you can use critical alerts: https://developer.apple.com/contact/request/notifications-critical-alerts-entitlement/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With