Created
October 23, 2019 16:52
-
-
Save milankamilya/985f795c8d29d442a1f79143d3703a51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function removePushNotification(body, prevNotificationID){ | |
var notification = new apn.Notification(); | |
notification.expiry = Math.floor(Date.now() / 1000) + 60; // Expires 1 min from now. | |
notification.badge = 1; //you can update the count as it required | |
notification.alert = body.alertMessage; | |
// for Silent Notification | |
notification.sound = ""; | |
notification.contentAvailable = true; | |
notification.payload = {'messageFrom': 'John Appleseed'}; | |
notification.topic = "<application bundle identifier>"; | |
notification.id = prevNotificationID; | |
apnProvider.send(notification, body.deviceToken).then( (result) => { | |
console.log('APNS Response : \n', result); | |
res.send('POST App Push Notification'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment