$rootScope.$on(’$cordovaPushV5:notificationReceived’, function(event, data) {
console.log(data.message)
var count = parseInt(data.count);
if (data.additionalData.foreground == true) {
cordova.plugins.notification.badge.set(count);
returnStatus();
returnMsgStatus();
} else {
cordova.plugins.notification.badge.set(count);
returnStatus();
returnMsgStatus();
}
});
is this code is running when notification occurs in background?. i also spent more time on this topic. any help is appreciated.
Please help. very urgent!!!.
Thanks
for the badge in background to need to add it to the push payload
how i add push payload? , please clear it to me.
var message = {
to: user.registrationId,
notification: {
title: ‘Title’,
body: 'New Message arrived ',
},
data: { //you can send only notification or only data(or include both)
msg: ‘private’,
badge: 5
}
};
I send the message through fcm like this. please help where to add push payload.
var message = {
to: user.registrationId,
notification: {
title: ‘Title’,
body: 'New Message arrived ',
badge: 5
},
data: { //you can send only notification or only data(or include both)
msg: ‘private’,
}
};
there you go
thanks sir, i also used content-variable":“1” parameter with this . and it works perfectly. thnks once again