Created
March 23, 2014 11:28
-
-
Save xingrz/9721883 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String enabledNotificationListeners = Settings.Secure.getString(context.getContentResolver(), "enabled_notification_listeners"); | |
// check to see if the enabledNotificationListeners String contains our package name | |
if (enabledNotificationListeners == null || !enabledNotificationListeners.contains(context.getPackageName())) { | |
// in this situation we know that the user has not granted the app the Notification access permission | |
throw new Exception(); | |
} else { | |
doSomethingThatRequiresNotificationAccessPermission(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment