2

I would like create app with custom badge number in app icon, like in facebook app: App icon in home screen shows pending/unread notifications. How to set custom badge number programatically in android. I've seen similar questions in stack with answers like it "doesn't support in stock android". Seen many answers and were old. I think they were for old versions. Is it possible in newer versions of android? If possible how to add customized badge number ? If the option is still doesn't support by android ignore this question and please let me know it. I'm developing kind of confidential app, so that i couldn't use third part libs. Is there any inbuilt methods to handle badges or possible to create badge?

SARATH V
  • 449
  • 6
  • 25
  • Possible duplicate of [How does Facebook add badge numbers on app icon in Android?](https://stackoverflow.com/questions/17510419/how-does-facebook-add-badge-numbers-on-app-icon-in-android) – Hristo Stoyanov Sep 11 '17 at 07:48
  • I've seen this answer. Doing kind of confidential app, so that i couldn't use third part libs. Is there any inbuilt methods to handle badges or possible to create badge? – SARATH V Sep 11 '17 at 07:53

1 Answers1

3

There is popular github that works app icon badges for most Android devices. Sure still some platform, some devices didn't support that. But those libraries almost cover all of the devices that support app icon badges.

https://github.com/leolin310148/ShortcutBadger

So to your question, No. Because Android framework didn't define the app notification badges before.(I am not sure if Android default framework have it now. I've been search the keyword of BADGE_COUNT_UPDATE in the ASOP android7 and nothing found) So all those custom badges are made by device manufacturer framework developer.

You can check how they setup badges numbers for each manufacturer here

https://github.com/leolin310148/ShortcutBadger/tree/master/ShortcutBadger/src/main/java/me/leolin/shortcutbadger/impl

To another question. I use keyword badge to search the ASOP source code and didn't find any noticeable part about app icon badges. And even there is one inbuilt framework method about this after certain version of android. The framework still cannot cover all the devices before the certain version. So not quite sure what do you mean by confidential app, but using libraries is the first choice to cover most android devices based on the real situation like this.

Shu Zhang
  • 451
  • 10
  • 18
  • 1
    I've seen this answer. Doing kind of confidential app, so that i couldn't use third part libs. Is there any inbuilt methods to handle badges or possible to create badge? – SARATH V Sep 11 '17 at 07:53
  • **I am not sure if Android default framework have it now. I've been search the keyword of BADGE_COUNT_UPDATE in the ASOP android7 and nothing found** . I don't either have this confirmation if exists or not . That's why the question posted here. Thanks for response. – SARATH V Sep 11 '17 at 08:15