问题
i am an android developer.i want to display notification count on launcher icon in android.It can be possible with "shortcutBadger" library but it is not working for android versions 5, 6 and 7. i don't want widget option.Can any one suggest me the solution. Thank you in advance.
回答1:
The shortcut badger support the notification counter on specific devices as it is stated in the repository description: "An Android library supports badge notification like iOS in Samsung, LG, Sony and HTC launchers."
This covers some huawei, xiaomi and other devices....it is not related to the OS version, you probably didn't pay attention to the devices list or didn't implement it correctly. (i've tested the library multiple times and works correctly)
So it is currently one of your best options if you want to support older OS versions.
https://github.com/leolin310148/ShortcutBadger
Also starting with Android 8 you can use the "similar" native option https://developer.android.com/guide/topics/ui/notifiers/notifications.html#Badges
来源:https://stackoverflow.com/questions/48669152/i-want-to-display-notification-count-badgeon-launcher-icon-in-android