How to access the Push Notification counter on Android (TV)?

Viewed 496

I would like to access the number of currently available push notifications The following :example has '1' push notification, here on a Android TV emulator image..

So how can I read that number?

EDIT: I do not want to set anything.

2 Answers

You can set a Custom notification count.

By default, each notification increments a number displayed on the long-press menu (visible in figure 1), but you can override this number for your app.

For example, this might be useful if you're using just one notification to represent multiple new messages but you want the count here to represent the number of total new messages.

To set a custom number, call setNumber() on the notification - in here below

public NotificationCompat.Builder setNumber(int number)

Sets the number of items this notification represents. On the latest platforms, this may be displayed as a badge count for Launchers that support badging. Prior to Build.VERSION_CODES.O it could be shown in the header. And prior to Build.VERSION_CODES.N this was shown in the notification on the right side.

Please Refer this article https://developer.android.com/training/notify-user/badges

Related