Android has a new notification listener service as of 4.3: http://developer.android.com/about/versions/jelly-bean.html http://developer.android.com/reference/android/service/notification/NotificationListenerService.html
From the docs:
Notification access is disabled by default — apps can use a new Intent to take the user directly to the Settings to enable the listener service after installation.
I don't see the intent to fire documented anywhere. Perusing the Settings doc doesn't seem helpful: http://developer.android.com/reference/android/provider/Settings.html
Looking at the Settings class directly: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/provider/Settings.java
I see ACTION_NOTIFICATION_LISTENER_SETTINGS defined, but when using Android Studio and pointing at 4.3 ACTION_NOTIFICATION_LISTENER_SETTINGS can't be resolved:
Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS);
Trying it more manually doesn't seem to work:
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("com.android.settings", "android.settings.NOTIFICATION_LISTENER_SETTINGS");
edit: doing it the correct way as CommonsWare pointed out below:
Intent intent=new Intent("android.settings.NOTIFICATION_LISTENER_SETTINGS");
leads to a crash:
(android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.NOTIFICATION_LISTENER_SETTINGS })
Am I missing something? I'm not sure how to send the user to the proper settings screen to enable this service in my app.
StatusBarNotification
– SophisticParcel
and that is not so easy to get all the different text messages from the notification – Sophistic