0

my story is make the number in top of icon or badge number like this home screen icon but it doesn't work all device why? and how I solve it?

  • 1
    It’s not an Android feature. Individual launcher apps can choose to support it. – Tenfour04 Nov 09 '21 at 04:05
  • Does this answer your question? [How to show Notification Count on My App Icon on Home Screen in Android](https://stackoverflow.com/questions/11665237/how-to-show-notification-count-on-my-app-icon-on-home-screen-in-android) – Evgeny Bovykin Nov 09 '21 at 15:07

1 Answers1

0

if notify a notification android system add a badge to your app icon, you can use below code to show notification

val id = "my_channel_01"
val name = getString(R.string.channel_name)
val descriptionText = getString(R.string.channel_description)
val importance = NotificationManager.IMPORTANCE_LOW
val mChannel = NotificationChannel(id, name, importance).apply {
    description = descriptionText
    setShowBadge(true)
}
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.createNotificationChannel(mChannel)
aref behboodi
  • 164
  • 2
  • 11