androidbadgeandroid-launcher

Is it possible to show the Notification Badge in Android from application code?


I understand the Notification Badge on the launcher icon in Android (8.0+) is automatically shown when a notification is received. Unfortunately, once they open or dismiss the notification the badge will be removed. What I'm wondering is, can the app itself directly tell the system to show the badge? I would like to show it when they have unread messages within the app.

I understand that some third party launchers and manufacturer variants of Android do offer additional badge functionality, however, I am referring to vanilla Android and the stock launcher.

Thank you.


Solution

  • I understand the Notification Badge on the launcher icon in Android (8.0+) is automatically shown when a notification is received

    Only if the launcher supports it. There are hundreds of launchers.

    can the app itself directly tell the system to show the badge?

    In terms of the standard Android SDK system, the badge will only appear if you raise a notification. Some launchers may offer an additional (documented or undocumented) API for apps to display badges on icons.