I am using NotificationListenerService
to handle device notifications:
@Override
public void onNotificationPosted(StatusBarNotification sbn) {
Log.d(TAG,"onNotificationPosted posted - ID :" + sbn.getId() + "\t"
+ sbn.getNotification().tickerText + "\t" + sbn.getPackageName());
}
The onNotificationPosted()
method is called after the notification has been posted on the device. Is there a way to catch it before it is presented?
I saw that reading notifications can also be achieved using the AccessibilityManager but again it's read after the notification popped.
Is there a way to delay the device notifications pop-ups until some moment?
I know I can delete a notification using the NotificationListenerService
as it come (after it popped to the user) and save it and try to relaunch it later. But I am having issues with the relaunching and again this is happening after the status bar notification is already shown.