任何人都知道“后台开始"在哪里. MIUI 11中的权限? [英] Anyone knows where is "start in background" permission in MIUI 11?

查看:492
本文介绍了任何人都知道“后台开始"在哪里. MIUI 11中的权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在MIUI 11 redmi note 6 pro mobile中启动活动,但出现以下错误:

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-权限被拒绝的活动

com.android.server.am.ExtraActivityManagerService: MIUILOG- Permission Denied Activity

我找到了一些解决方案,例如启用在后台启动"权限.我在MIUI 11中找不到类似的东西.从字面上看,我对这个问题一无所知.预先感谢.

I found some solution like turn on "start in background" permission. I can't find something like this with MIUI 11. Literally I have no idea about this issue. Thanks in advance.

推荐答案

在应用程序停止时,我从BroadcastReceiver启动活动也遇到类似的问题.

1):您可以在设置中找到您的应用,并允许权限在后台启动" .
2)如果您需要以编程方式允许权限,请尝试打开应用程序设置

I have a similar problem with starting activity from BroadcastReceiver when application is stopped.

1) You can find your app in the settings and allow permission "start in the background".
2) If you need to allow permission programmatically, try to open application settings

此代码将打开应用程序权限设置,您应在其中设置从后台启动"

This code will open applicatin permissions settings in which you should allow "start in the background"

Intent intent = new Intent("miui.intent.action.APP_PERM_EDITOR");
intent.setClassName("com.miui.securitycenter",
"com.miui.permcenter.permissions.PermissionsEditorActivity");
intent.putExtra("extra_pkgname", getPackageName());
startActivity(intent);


此代码将打开应用程序设置,您应在其中打开权限并允许在后台启动" 权限

This code will open the applicatin settings in which you should open permissions and allow "start in the background" permission

Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

了解有关android设置意图的更多信息: 如何以编程方式在应用程序设置中打开应用程序许可窗口

Read more about android settings intents: How to open application permission window in app settings programmatically

您还可以从github中检查代码,以在不同的系统包装器(如flyme,miui,oppo等)中使用权限: https://github.com/zhaozepeng/FloatWindowPermission

And you can also check the code from github to work with permissions in different system wrappers like flyme, miui, oppo etc: https://github.com/zhaozepeng/FloatWindowPermission

这篇关于任何人都知道“后台开始"在哪里. MIUI 11中的权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆