public void requestSystemAlertPermission() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            try {
                if (!isSystemAlertGranted()) {
                    Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + context.getPackageName()));
                    context.startActivityForResult(intent, OVERLAY_PERMISSION_REQ_CODE);
                } else {
                    permissionCallback.onPermissionPreGranted(Manifest.permission.SYSTEM_ALERT_WINDOW);
                }
            } catch (Exception ignored) {}
        } else {
            permissionCallback.onPermissionPreGranted(Manifest.permission.SYSTEM_ALERT_WINDOW);
        }
    }
public void requestSystemAlertPermission ( ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . M ) { try { if ( ! isSystemAlertGranted ( ) ) { Intent intent = new Intent ( Settings . ACTION_MANAGE_OVERLAY_PERMISSION , Uri . parse ( "package:" + context . getPackageName ( ) ) ) ; context . startActivityForResult ( intent , OVERLAY_PERMISSION_REQ_CODE ) ; } else { permissionCallback . onPermissionPreGranted ( Manifest . permission . SYSTEM_ALERT_WINDOW ) ; } } catch ( Exception ignored ) { } } else { permissionCallback . onPermissionPreGranted ( Manifest . permission . SYSTEM_ALERT_WINDOW ) ; } }
used only for {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW}