I trying to handle the new permission model in Android version 23 using the library called Dexter:
https://github.com/Karumi/Dexter
Problem is that if i need to check permission access to SYSTEM_ALERT_WINDOW callback onPermissionDenied is always called without the displaying the permission dialog.
PermissionListener dialogPermissionListener = new PermissionListener() {
@Override public void onPermissionGranted(PermissionGrantedResponse response) {
Logger.d("onPermissionGranted");
}
@Override public void onPermissionDenied(PermissionDeniedResponse response) {
Logger.d("onPermissionDenied");
}
@Override public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {
Logger.d("onPermissionRationaleShouldBeShown");
}
};
Dexter.checkPermission(dialogPermissionListener, Manifest.permission.SYSTEM_ALERT_WINDOW);
How can i do permission check in the right way?
Note: Permission check is processed in the service, not in the Activity because service should to display SYSTEM_ALERT_WINDOW above the all other windows in the app (is permission is granted).
Many thanks for any advice.