hi all,
i want to start activity from service.
but xiaomi phone and maybe poco phone have to get 'Start in Background' permission.
Can anyone change the code for me to b4a code?
I need a sub to get access and a sub to check this access.
This code will open applicatin permissions settings in which you should allow "start in the background"
This code will open the applicatin settings in which you should open permissions and allow "start in the background" permission
The following code is not for 'Start in Background' access.
But this access is almost close to the 'Start in Background 'access and with some changes the 'Start in Background' access
i want to start activity from service.
but xiaomi phone and maybe poco phone have to get 'Start in Background' permission.
Anyone knows where is "start in background" permission in MIUI 11?
I'm not able to start activity in MIUI 11 redmi note 6 pro mobile, I am getting error as: com.android.server.am.ExtraActivityManagerService: MIUILOG- Permission Denied Activity I found some sol...
stackoverflow.com
I need a sub to get access and a sub to check this access.
This code will open applicatin permissions settings in which you should allow "start in the background"
Java:
Intent localIntent = new Intent("miui.intent.action.APP_PERM_EDITOR");
localIntent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.PermissionsEditorActivity");
localIntent.putExtra("extra_pkgname", getPackageName());
startActivity(localIntent);
Java:
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
The following code is not for 'Start in Background' access.
But this access is almost close to the 'Start in Background 'access and with some changes the 'Start in Background' access
Java:
public static boolean canDrawOverlayViews(Context context)
{
if (Build.VERSION.SDK_INT < 21)
return true;
try
{
return Settings.canDrawOverlays(context); } catch (NoSuchMethodError e) {
}
return canDrawOverlaysUsingReflection(context);
}
public static boolean isXiaomi()
{
return "xiaomi".equalsIgnoreCase(Build.MANUFACTURER);
}
private static boolean canDrawOverlaysUsingReflection(Context context)
{
try
{
AppOpsManager manager = (AppOpsManager)context.getSystemService("appops");
Class clazz = AppOpsManager.class;
Method dispatchMethod = clazz.getMethod("checkOp", new Class[] { Integer.TYPE, Integer.TYPE, String.class });
int mode = ((Integer)dispatchMethod.invoke(manager, new Object[] { Integer.valueOf(24), Integer.valueOf(Binder.getCallingUid()), context.getApplicationContext().getPackageName() })).intValue();
return mode == 0; } catch (Exception e) {
}
return false;
}
Last edited: