Display over other apps Permissions error

My application requires hover window permissions,How do I use it?
error is: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.action.MANAGE_OVERLAY_PERMISSION
code:Class clazz = Settings.class;
Field field = clazz.getDeclaredField(“ACTION_MANAGE_OVERLAY_PERMISSION”);
Intent intent = new Intent(field.get((Object)null).toString());
intent.setFlags(268435456);
intent.setData(Uri.parse(“package:” + context.getPackageName()));
context.startActivity(intent);

@tenk.wang, @jasonl

@si5hao Define the permission in manifest.xml for SYSTEM_ALERT_WINDOW

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
1 Like

my AndroidManifest.xml have

but show error:android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.action.MANAGE_OVERLAY_PERMISSION

@si5hao Is this vim3 Android 9?

@si5hao Add the code to try it

if (!Settings.canDrawOverlays(context)) {
    Intent intent = new Intent();
    intent.setAction(Settings.ACTION_MANAGE_OVERLAY_PERMISSION);
    context.startActivity(intent);
}

error is: Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.action.MANAGE_OVERLAY_PERMISSION }. on line context.startActivity(intent);
I use vim3 Android 9

@si5hao I’ll test it tomorrow, Thank you for wait.

@si5hao Due to the setting application of vim3 have not activity(settings. action. MANAGE_ OVERLAY_ Permission).
You can sign the apk to fix it.
Manifest.xml

android:sharedUserId="android.uid.system"
...
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

If you want this key(platform.pk8 platform.x509.pem) files, give me an email and I’ll send it to you.

Thank you very much!I’ll try this method。
My email address is si5hao@163.com

@si5hao The mail has been sent, please check it.