Ionic1, display badge count when push notification arrives

177 views
Skip to first unread message

zille abbas

unread,
Jun 23, 2017, 9:09:17 AM6/23/17
to phonegap

Hi,

i am working with ionic 1 app and implemented push notifications in it. Now i am trying to implement badge on app icon and for that purpose i am using cordova plugin which is (Cordova Badge Plugin ). it is working when push notifications arrives and by clicking on that notification it opens the app and i have implemented badge logic there. i code it like this.


$rootScope.$on('cloud:push:notification', function (event, data) {
document.addEvenLtistener('deviceready', function () {
cordova.plugins.notification.badge.requestPermission(function (granted) {
cordova.plugins.notification.badge.set(10);
});
}, false);
var msg = data.message;
alert(msg.title + ': ' + msg.text);
});


on closing app it shows badge and when i open app again it clears the badge so i know how actually badge is working. To clear badge i am doing code like this.


document.addEventListener('deviceready', function () {
cordova.plugins.notification.badge.clear();
}, false);


All i want is to display the badge count on app icon when the notification arrives, right now it shows the count but only when i open the app.

ALI Chamsoudine

unread,
Jul 18, 2017, 11:53:22 AM7/18/17
to phonegap
I am confronted with the same problem. I'm trying to put badges in Android. How do I do that? Any help would be appreciated.
Reply all
Reply to author
Forward
0 new messages