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?
You can see your Android notification history on Android 11 through the Settings app. You first need to turn on Notification history in your phone's notification settings. You will then be able to see all the alerts you dismissed in the past 24 hours.
A screen overlay is a part of an app that displays over other apps, such as the chat heads in Facebook Messenger. If you receive a screen overlay error because an app is blocking part of another app on your screen, you can turn off this permission.
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(). Thought 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.
You can use NotificationListenerService, it's easy to use, look at this blog post.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With