I need a badge counter on my application launcher icon.
I know the solution to get Badge counter inside the app, using TextView, But I need a solution to get the badge counter external to the app on the launcher icon.
In iOS we get the badge number count by
UIApplication.sharedApplication().applicationIconBadgeNumber
I am wondering why Android has not included anything like this with their SDK which every developer need.
Try 1 : Working only on sony mobiiles :
Intent badgeIntent = new Intent();
badgeIntent.setAction("com.sonyericsson.home.action.UPDATE_BADGE");
badgeIntent.putExtra("com.sonyericsson.home.intent.extra.badge.PACKAGE_NAME", this.getPackageName());
badgeIntent.putExtra("com.sonyericsson.home.intent.extra.badge.ACTIVITY_NAME", this.getClass().getName());
badgeIntent.putExtra("com.sonyericsson.home.intent.extra.badge.SHOW_MESSAGE", ShwMsgBulVar);
badgeIntent.putExtra("com.sonyericsson.home.intent.extra.badge.MESSAGE", "10");
context.sendBroadcast(badgeIntent);
Try 2 : I tried the library : https://github.com/leolin310148/ShortcutBadger
It works only for few manufacturers and not common for all android mobiles.
ShortCutBadger is not working on OPPO, VIVO, Xiomi, Reliance LYF default launchers.
After couple of research, I came to know that, badge number depends on launcher manufacturer and listed as below :
ShortCutBadger Suported :
ShortCutBadger not Suported :
So is there any other general method which can work on all manufacturer mobiles?
Read so many posts and did lot of search but Many tell there is no such generic solution which is applicable for all launchers.
But I feel there is a solution because whatsapp and facebook app display the badge number in all the above mentioned launcher.
There is no such function in Android as badge numbers are not a part of the platform. A few libraries exist that try to achieve this such as https://github.com/leolin310148/ShortcutBadger but you should understand that it does not work for every manufacturer's device. Also as far as I understand the badges only appear over the icon when it is on a home screen and not in the app drawer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With