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

Add shouldShowRequestPermissionRationale method #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tony---Zhang
Copy link
Contributor

PermissonManager miss an important method, so I just added it.

Add shouldShowRequestPermissionRationale method into the PermissionManager.

*/
@SuppressWarnings("unused")
public static boolean shouldShowRequestPermissionRationale(@Nullable Activity activity, @NonNull String permission) {
return activity == null || ActivityCompat.shouldShowRequestPermissionRationale(activity, permission);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be activity != null && ActivityCompat... because if the activity is null (let's assume we are in a Fragment detached from its parent activity), then actually requesting the permission will fail as it also requires an activity, which means we don't care about showing the rationale because we won't be able to show the permissions request dialog.

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.

3 participants