0

I am developing an app that allows a user to connect to a specific wifi network using the google vision api to scan a QR code containing an ssid. To scan for wifi networks I need to request the user to grant the location permission. This all works fine if i go to the settings and manually enable the Location permission but when requesting the permission at run-time, the user taps enable then a second dialog pops up, Screen Overlay Detected which requires a context switch to enable the Screen Overlay permission. I am not drawing over other apps and when i manually enable the location permission there is no problems. So why is this permission dialog popping up?

As I am not sure why Android is asking for this permission i am not sure what code to post. i have included the request for the 3 required permission for the change network request.

final int permissionCheck = ContextCompat.checkSelfPermission(mActivity, Manifest.permission.CAMERA);
final int locationPermissionCheck = ContextCompat.checkSelfPermission(mActivity, Manifest.permission.ACCESS_COARSE_LOCATION);
final int wifiPermissionCheck = ContextCompat.checkSelfPermission(mActivity, Manifest.permission.CHANGE_WIFI_STATE);
final int granted = PackageManager.PERMISSION_GRANTED;
if ((permissionCheck != granted) || (locationPermissionCheck != granted) || (wifiPermissionCheck != granted)) {
    ActivityCompat.requestPermissions(mActivity, new String[]{
            Manifest.permission.CAMERA,
            Manifest.permission.ACCESS_COARSE_LOCATION,
            Manifest.permission.CHANGE_WIFI_STATE

    }, 0);

} else {
    cameraSource.start(cameraView.getHolder());
}

Update

Turns out its not just the location permission that trips it up. Any permission request is experiencing the same behaviour.

Lonergan6275
  • 1,938
  • 6
  • 32
  • 63

1 Answers1

0

It may be some libraries you are using in your that requires screen overlay permission. Can you check the libraries you are using in your and the permission they require.

Praveen
  • 697
  • 6
  • 21
  • after quick look around i don't see any mention of this permission in the docs for the libraries I am using. also wouldn't explain why the app works perfectly fine if location is manually enabled in settings and screen overlay permission left unchanged. – Lonergan6275 Aug 22 '16 at 12:57