Android - how to add a badge count to an application icon?
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.
Is there a way to add a badge to an application icon in Android?
Unfortunately, Android does not allow changing of the application icon because it's sealed in the APK once the program is compiled. There is no way to programmatically change it to a 'drawable'.
You may achieve your goal by using a widget instead of an icon. Widgets are highly customisable and can do what you want.
There's a short discussion about the difference between iPhone icon notification and using widgets here:
http://www.cnet.com/8301-19736_1-10278814-251.html
As you'll notice, there is virtually no difference between using a widget or an icon, since they can be the same size and look the same.
How set badge number in home screen app icon android programatically?
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.
Application icon badge not displayed Android
Thanks to Bob and his link : https://support.google.com/pixelphone/thread/1575301?hl=en,
I found out I had to go to settings < apps and notifications < special app access < notifications < notification access < turn on for "pixel launcher". Then the notification dots would appear as expected !
Well time to write my report I guess.
Related Topics
Arrayadapter in Android to Create Simple Listview
Android Log.V(), Log.D(), Log.I(), Log.W(), Log.E() - When to Use Each One
About Android Image and Asset Sizes
Read Only File System on Android
How to View Androidmanifest.Xml from APK File
How to Set Textview Textstyle Such as Bold, Italic
React-Native: Command Not Found
Adb Not Responding - Wait More or Kill Adb or Restart (Ubuntu 13) 64-Bit
Is There a Realm Browser for Linux
Export a Python Script to an Android Executable (.Apk) with Python-For-Android
Difficulties with Calling an Android Ndk Function from Directly Delphi
Building Just One Tool from Android Source (Aosp)
Android Plugin Install Problems in Eclipse
Do X86 Android Avd's Work on Linux on Amd
What Is Exactly a "Clock Tick" in the Context of Android CPU Usage
How to Change Endianness Mid-Execution on Arm (Android/Linux)