i want to display notification count (badge)on launcher icon in android

落爺英雄遲暮 提交于 2019-12-11 15:00:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!