nabinbhandari / Android-Permissions

Library for easy handling of android run-time permissions.
410 stars 84 forks source link

Permission dialog quits the second time around. #3

Closed ChinHairSaintClair closed 6 years ago

ChinHairSaintClair commented 6 years ago

When I deny the all permissions I requested: First time round - Opens a dialog with the user specific method. Second time round - Quits and no callback methods are triggered.

My goal is to continue to ask the user to accept the permissions or block them outright.

nabinbhandari commented 6 years ago

Hello, please clarify your problem. Also post the code to reproduce the problem.

ChinHairSaintClair commented 6 years ago

I've used the API method that takes multiple permissions. Requesting fine location and storage.

image

On granted I want to continue the normal app flow

Should any permission be blocked, a different route will be followed.

However in the onDenied, if any permission has been not been granted, the user should be displayed the permission again. I have tried calling requestUserPermissions() again (which is the function name that contains the code snippet). When that did not work I tried refreshing the activity all together to ask the user the permissions again. Both seemed to produce the same outcome. The user is asked for the permissions, however it on the second time round the onDenied method is not triggered and the app just continues.

nabinbhandari commented 6 years ago

Hello, I have made an attempt to fix the issue. Can you please checkout the branch "temp" and verify if it has been solved?

To test:

If you don't mind, also check if other features are working correctly.

ChinHairSaintClair commented 6 years ago

Good day

I have tested as you requested. Within my program the 'onDenied' functionality triggers as expected now. However: If multiple permissions are requested at runtime and the matching permissions are not placed in manifest, then (at least in my case with 'location' and 'write') the first permission is requested - and then skips into the onBlocked.

EDIT: 'Can not perform this action after onSaveInstanceState' error is due to my mistake.

nabinbhandari commented 6 years ago

"Blocked" means that that permission cannot be asked from the user again, and if the permissions are not declared in the manifest, it cannot be requested, hence the callback onBlocked is called. It is the responsibility of a developer to keep the necessary permissions in the manifest.

For another error, please provide me with the code to reproduce it.

ChinHairSaintClair commented 6 years ago

Great stuff, thank you for the explanation and the quick responses. Everything works as expected.

nabinbhandari commented 6 years ago

Sorry for the late response. I have merged the code and released new version 3.7.