MANAGE_OVERLAY_PERMISSION - activity not found exception

Viewed 5293

I'm getting following exception:

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.action.MANAGE_OVERLAY_PERMISSION dat=package:com.my.app }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1816)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1525)
at android.app.Activity.startActivityForResult(Activity.java:4265)

This happened in an app that's already a few years old and is working flawlessly. Now I got this exception for an android 7 device, model ZUK Z1. Any ideas? Seems like a problem with the rom. Does this rom offer an alternative way to get overlay drawing permissions?

Edit - here's the function I use to get permissions

public static void checkOverlayPermission(Activity activity)
{
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.canDrawOverlays(activity))
    {
        Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + activity.getPackageName()));
        activity.startActivityForResult(intent, BaseDef.OVERLAY_PERMISSION_REQ_CODE);
    }
}
2 Answers

What worked for me:

            var intent = new Intent(Android.Provider.Settings.ActionManageOverlayPermission);
            intent.SetData(Android.Net.Uri.FromParts("package", PackageName, null));
            StartActivity(intent);

This is in Xamarin tho!

Related