Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SYSTEM_ALERT_WINDOW through Settings.canDrawOverlays() #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Dima-369
Copy link

getPermissionsListToRequest() uses ActivityCompat.checkSelfPermission() to check if the permission is granted.

SYSTEM_ALERT_WINDOW is a 'special' dangerous permission, requiring the grant process through a special Settings.ACTION_MANAGE_OVERLAY_PERMISSION intent. Apparently, even if granting the access through the new Activity, ActivityCompat.checkSelfPermission() will return PERMISSION_DENIED.

I propose this tiny fix with uses Settings.canDrawOverlays() for SYSTEM_ALERT_WINDOW instead. Before requestAllManifestPermissionsIfNecessary() always called onDenied() if you worked with the special permission despite granting all other permissions access!

Dmytro Butemann added 2 commits February 24, 2016 23:38
This prepares the method to call Settings.canDrawOverlay().
checkSelfPermission() always returns PERMISSION_DENIED for
SYSTEM_ALERT_WINDOW as it is supposedly a dangerous 'special'
permission which needs to be granted through an Intent.
@Dima-369
Copy link
Author

Hmm, maybe this isn't the correct way to handle this!

I guess it would be better if getManifestPermissions() simply does not return SYSTEM_ALERT_WINDOW as it is used very rarely anyway.

Then we should add a note to the README.md for this behavior!
Extending requestAllManifestPermissionsIfNecessary() with the new Intents would probably be quite unexpected as the Android Intent opens an entirely new Activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant