java – How to get a list of current notifications in the status bar on API 17?

Question:

The task is to extract text from notifications in the status bar via adb . At the moment, I wrote a Service that monitors notifications, inherits from NotificationListenerService and Broadcast , which, upon request from adb sends notification data from a specific package. But the NotificationListenerService itself is available only from 18 APIs, and the extras field of the Notification class (I take the text and title from it) – from the 19th.

Maybe there is some way to get the same data, but on the 17th API?

Answer:

Fortunately, the answer has been found!

The solution is quite trivial – data on all notifications can be obtained through the shell dumpsys notification . But we haven't been able to get extras yet. True, all my devices are rooted, please write down in the comments if it works without root.

Scroll to Top