我想在 android 中的启动器图标上显示通知计数(徽章) [英] i want to display notification count (badge)on launcher icon in android
问题描述
我是 android 开发人员.我想在 android 中的启动器图标上显示通知计数.可以使用shortcutBadger"库,但它不适用于 android 版本 5、6 和 7.我不想要小部件选项.任何人都可以向我建议解决方案.提前致谢.
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.
推荐答案
快捷方式獾支持特定设备上的通知计数器,正如存储库描述中所述:Android 库支持像三星、LG、索尼和 HTC 发射器."
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
同样从 Android 8 开始,您可以使用类似"本机选项 https://developer.android.com/guide/topics/ui/notifiers/notifications.html#Badges
Also starting with Android 8 you can use the "similar" native option https://developer.android.com/guide/topics/ui/notifiers/notifications.html#Badges
这篇关于我想在 android 中的启动器图标上显示通知计数(徽章)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!