1

I am trying to get all the information from a StatusBarNotification (sbn). I've already set up the NotificationListenerService. I was able to get EXTRA_TITLE, EXTRA_TEXT and EXTRA_LARGE_ICON. But I unable to get the expandable image.

I am checking the notification extras to see if any keys exist related to images. But all of them are returning false except EXTRA_LARGE_ICON if it's exists. NotificationCompat.EXTRA_LARGE_ICON returns the profile picture.

Log.d("EXTRA_BACKGROUND_IMAGE_URI",
    extras.containsKey(NotificationCompat.EXTRA_BACKGROUND_IMAGE_URI))
Log.d("EXTRA_LARGE_ICON",
    extras.containsKey(NotificationCompat.EXTRA_LARGE_ICON))
Log.d("EXTRA_LARGE_ICON_BIG",
    extras.containsKey(NotificationCompat.EXTRA_LARGE_ICON_BIG))
Log.d("EXTRA_LARGE_ICON_BIG",
    extras.containsKey(NotificationCompat.EXTRA_SMALL_ICON))
Log.d("EXTRA_PICTURE",
    extras.containsKey(Notification.EXTRA_PICTURE))

Expandable notification image

I am doing all these in override fun onNotificationPosted(sbn: StatusBarNotification?) method.

override fun onNotificationPosted(sbn: StatusBarNotification?) {
    val extras = sbn.notification.extras
    ...
}
Jeeva
  • 3,975
  • 3
  • 23
  • 47

0 Answers0