Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 993
smail2133 Avatar asked Nov 04 '14 09:11

smail2133


People also ask

Can you see History of notifications on Android?

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.

What is phone displaying over other apps?

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.


2 Answers

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.

like image 136
nunofmendes Avatar answered Oct 18 '22 19:10

nunofmendes


You can use NotificationListenerService, it's easy to use, look at this blog post.

like image 42
Daniele Campogiani Avatar answered Oct 18 '22 20:10

Daniele Campogiani