Skip to content

Commit

Permalink
Update FCM message with APNS speccific payload for background notific…
Browse files Browse the repository at this point in the history
…ations (#456)

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
  • Loading branch information
digitaldan authored May 26, 2024
1 parent 4e56622 commit 22526ee
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions notificationsender/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,20 @@ function sendMessage(registrationIds, data) {
tokens: Array.isArray(registrationIds) ? registrationIds : [registrationIds],
android: {
priority: 'high',
},
//for IOS we need to set an actual notification payload so they show up when the app is not running
//right now the IOS app does not render background notifications, when it does, we can remove this
apns: {
payload: {
aps: {
badge: 0,
sound: { name: 'default' },
alert: { body: data.message },
}
}
}
};

firebase.messaging().sendMulticast(message)
.then((response) => {
logger.info("Response: " + JSON.stringify(response));
Expand Down

0 comments on commit 22526ee

Please sign in to comment.