Android应用程序图标中的通知计数徽章 [英] Notification Count Badge in Android App Icon
问题描述
我正在开发Android应用程序,其中我正在使用Firebase Cloud Messaging Service向用户发送通知.为了使用户更了解通知,我想在应用程序的启动器图标上显示通知的数量. 有什么办法可以做吗? 我不想创建一个小部件. 我已经尝试了图书馆ShortcutBadger 图书馆链接
I am developing and android application, where I am sending notifications to the user using Firebase Cloud Messaging Service. In order to make user more aware of notifications, I want to show the count of the notifications on the launcher icon of the app. Is there any way how can I do it? I don't want to create a widget. I have tried the library ShortcutBadger Link for the Library
但是这个库的问题是当应用程序在后台或被杀死时,它不起作用?
But the issue with this library is that it is not working when the app is in background or killed?
我已经在我的应用程序的BroadcastReceiver中使用了计数更新方法
I have used the count update method in the BroadcastReceiver of my app
有人可以建议如何使用它或更好的方法吗?
Can someone suggest how to use it or a better way of doing it?
推荐答案
Android O引入了通知徽章:
Android O introduces notification badges:
https://developer.android.com/preview/features/notification -badges.html
长按图标可显示通知数量.不过,要O广泛采用还需要一段时间.
They show the number of notifications with a long-press on the icon. It will be awhile before O has widespread adoption, though.
这篇关于Android应用程序图标中的通知计数徽章的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!