Click here to Skip to main content
15,868,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,
I try to show badge count in app icon , but it not showing count.
I am using "cordova-plugin-firebase-messaging" and "cordova-plugin-badge" in Cordova CLI for Android,but not show badge count in app icon.

What I have tried:

In index.js file on ondeviceready function i call the below code to show badge.

JavaScript
function onDeviceReady() {
  
  
    //For cordova.plugin-badge plugin
    cordova.plugins.notification.badge.clear();
    cordova.plugins.notification.badge.set(3);

    //For cordova.plugins.firebase.messaging plugin
    cordova.plugins.firebase.messaging.setBadge(3);

}


And i tried ShortcutBadger also using following code,
JavaScript
document.addEventListener('deviceready', onDeviceReady, false);


function onDeviceReady() {
  

    ShortcutBadger.applyCount(context, 3); //for 1.1.4+
    ShortcutBadger.with(getApplicationContext()).count(3); //for 1.1.3
  
    
}


But not show count in icon,any reply much appreciated.

Thanks and regards,
Aravind
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900