13

how to add badge count on app icon on homescreen , like inbuilt gmail app, facebook app. I can run with Samsung and Sony devices. But others like Motorola , Micromax, HTC , LG does not sets Badge.

So how to set badge count for all android devices?

user2231294
  • 153
  • 1
  • 1
  • 10
  • 1
    @RichardLeMesurier Read "badge count" and thought "unclear what you're asking", but now I understand. Definitely duplicate, but your answer is still useful. – 0101100101 Sep 16 '14 at 10:03
  • @0101100101 I'm not sure where the name "badge" came from, but it is now the common term, and has been incorporated as such into most of the APIs for this (perhaps it comes from the original iOS implementation). – Richard Le Mesurier Sep 16 '14 at 10:14

2 Answers2

19

It is currently not possible to target "all android devices", only for some.

Certain manufacturers (e.g. Samsung notably) have included this functionality into their customised Android launchers. Also some 3rd-party launchers (e.g. Nova Launcher) have included an API to accomplish this.

Stock Android does not offer this functionality at the moment on the standard launcher.


I have just seen that this is a duplicate of:

There are many other related posts about this type of thing:

You can find more information there.

Community
  • 1
  • 1
Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255
9

You can use library that bring you this ability.

ShortcutBadger is one on them that support many launchers.

For use this library you can add it to your gradle build dependency like this:

dependencies {
    compile 'me.leolin:ShortcutBadger:1.1.4@aar'
}

And add Badge like this:

ShortcutBadger.applyCount(context, badgeCount);
Mohamad Khani
  • 332
  • 4
  • 13