androidandroid-6.0-marshmallowcustom-rom

check permission of draw over apps for Custom ROM


As per standard android document we need to ask for permission on Marshmallow or newer versions. Right now I done with checking for M device and the particular permission. App is working fine on all devices.

Actual Problem

I come up with MIUI and similar Custom Android ROM. This ROM have introduce this feature on the 5.1.1 device. Here we had major breakdown.

If we check draw over apps on below Marshmallow its crashing on original ROM. Also we check for permission on MIUI device it not giving any result.

Tell me if you ever come How can app check/enable for draw over apps on the Custom ROM like MIUI?

Here is Code

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    if(!Settings.canDrawOverlays(getBaseContext())) {
        Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
        Uri.parse("package:" + packageName));
        startActivityForResult(intent, REQ_CODE_REQUEST_SETTING);
    } else{
        //Do Draw over apps
    }
} else {
    //Do Draw over apps
}

Solution

  • Problem is Solved. MIUI updated their OS.