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

onPermissionResult called multiple times on Android 6.0.1 even before responding to dialog #4

Open
TripwireNL opened this issue Jul 5, 2017 · 0 comments

Comments

@TripwireNL
Copy link

TripwireNL commented Jul 5, 2017

Hi,

I'm having an issue on my Samsung Galaxy S6 edge where i'm requesting permissions and even before the user has tapped on the allow or deny button the onPermissionResult is called.
@Override public void onPermissionsResult(String[] grantedPermissions, String[] refusedPermissions) throws SecurityException { if (refusedPermissions.length > 0 || grantedPermissions.length < 5) { requestPermissions(); } else { checkInternetConnection(); } }
I've set a breakpoint at requestPermissions and checkInternetConnection and it seems that when the dialog of the permission request is active, the onPermissionResult keeps getting called like it's in some sort of loop.

My code for requesting permissions:

private void requestPermissions() {
        PermissionsResultListener listener = this;
        if (    !PermissionHelper.isExternalStoragePermissionGranted(activity) ||
                !PermissionHelper.isLocationPermissionGranted(activity) ||
                !Permissive.checkPermission(activity, Manifest.permission.CAMERA)) {

            new Permissive.Request(
                    Manifest.permission.WRITE_EXTERNAL_STORAGE,
                    Manifest.permission.READ_EXTERNAL_STORAGE,
                    Manifest.permission.ACCESS_COARSE_LOCATION,
                    Manifest.permission.ACCESS_FINE_LOCATION,
                    Manifest.permission.CAMERA)
                    .withRationale(new AskPermissionsFragment())
                    .whenPermissionsResultReceived(listener)
                    .execute(activity);
        } else {
            checkInternetConnection();
        }
    }```

@TripwireNL TripwireNL changed the title onPermissionResult called multiple times on Android 6.0.1 onPermissionResult called multiple times on Android 6.0.1 even before responding to dialog Jul 17, 2017
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

No branches or pull requests

1 participant