NotificationListenerService get Notification Icon?

后端 未结 2 1540
半阙折子戏
半阙折子戏 2021-01-01 05:34

In a Service extending the new (SDK18, JB-4.3) NotificationListenerService, I\'d like to get the Notification\'s status bar icon.

mStatusBarNotif

2条回答
  •  [愿得一人]
    2021-01-01 05:51

    Use getPackageName() on StatusBarNotification to find out the app that posted the Notification. You can then use createPackageContext() to get a Context for that package, then use that Context to retrieve the image (e.g., via getResources()).

提交回复
热议问题