Answer

To open NotificationAccessSettingsActivity via intent you could do something like this:

startActivity(new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS));

If you want to check the permission you could use:

private boolean isNotificationServiceRunning() {
ContentResolver contentResolver = getContentResolver();
String enabledNotificationListeners =
        Settings.Secure.getString(contentResolver, "enabled_notification_listeners");
String packageName = getPackageName();
return enabledNotificationListeners != null && enabledNotificationListeners.contains(packageName);

}

  • 1
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions