[英]Android push notification badge counter on Home Screen
For Facebook/Whatsapp/Twitter, there is this option on the notification setting page of Android: " Home screen app icon badge " screenshot attached.对于 Facebook/Whatsapp/Twitter,在 Android 的通知设置页面上有这个选项:附上“主屏幕应用程序图标徽章”截图。
How Can I get this first option for my app, where I have only these two options:如何为我的应用程序获得第一个选项,我只有这两个选项:
I couldn't find any relevant information on the web.我在 web 上找不到任何相关信息。 Any help will be appreciated.
任何帮助将不胜感激。
When you build a notification you can request access to show badge on app launcher.当您构建通知时,您可以请求访问以在应用启动器上显示徽章。
You can try something like this你可以试试这样的
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
getSystemService(NotificationManager::class.java)?.createNotificationChannel(
NotificationChannel(
CHANNEL_STRING_ID,
resources.getString(R.string.app_name),
NotificationManager.IMPORTANCE_HIGH
).apply {
enableVibration(true)
setShowBadge(true)
})
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.