Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - how to add a badge count to an application icon? [duplicate]

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?

like image 640
user2231294 Avatar asked Sep 16 '14 07:09

user2231294


2 Answers

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:

  • Is there a way to add a badge to an application icon in Android?

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

  • How does Facebook add badge numbers on app icon in Android?
  • https://stackoverflow.com/questions/18205569/does-samsung-modifies-its-android-roms-to-have-badges-on-email-and-sms-icons?rq=1
  • adding notification badge on app icon in android
  • How to interface with the BadgeProvider on Samsung phones to add a count to the app icon?
  • How to add a notification badge/count to application icon on Sony Xperia devices?
  • How to make application badge on android?
  • How to display count of notifications in app launcher icon

You can find more information there.

like image 158
Richard Le Mesurier Avatar answered Oct 14 '22 15:10

Richard Le Mesurier


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);
like image 28
Mohamad Khani Avatar answered Oct 14 '22 15:10

Mohamad Khani