'Android: Is it possible to get other apps notification info?
I have question about Accessibility Service in Android.
Can I catch a notification in status bar and get info from notification?
My purpose is to catch notification of apps like Viber, Skype.
Is that possible?
Solution 1:[1]
You can check out NotificationListenerService. Not sure if it answers what you need but according to the docs:
A service that receives calls from the system when new notifications are posted or removed, or their ranking changed.
You can get the active notifications with getActiveNotifications(). Though I have never tested this and do not know if it gets other apps notifications in the status bar or only yours.
This is the current description of that method:
Request the list of outstanding notifications (that is, those that are visible to the current user). Useful when you don't know what's already been posted.
You can get more info @ NotificationListenerService
Note: This method is only available on API 18.
Further investigation I've found an example made by another user on how to use NotificationListenerService:
https://github.com/kpbird/NotificationListenerService-Example
AccessibilityService is to handle accessibility touches:
An accessibility service runs in the background and receives callbacks by the system when AccessibilityEvents are fired. Such events denote some state transition in the user interface, for example, the focus has changed, a button has been clicked, etc. Such a service can optionally request the capability for querying the content of the active window. Development of an accessibility service requires extending this class and implementing its abstract methods.
Solution 2:[2]
You can use NotificationListenerService, it's easy to use, look at this blog post.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | abdul-wahab |
Solution 2 | Daniele Campogiani |