如何以编程方式检查MIUI自动启动权限? [英] How to check MIUI autostart permission programmatically?

查看:168
本文介绍了如何以编程方式检查MIUI自动启动权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要以编程方式检查MIUI手机中我的应用程序的自动启动权限是打开还是关闭. Facebook和whatsapp均已默认启用此权限,该如何启用?

I need to check programmatically if the auto start permission for my app in MIUI phone is on or off. Facebook and whatsapp have this permission already enabled by default , how can I do so?

推荐答案

目前不可能.

因为这完全取决于他们的操作系统API和自定义.甚至开发人员也在XIOMI的官方论坛上都要求这样做,但是那里没有任何回应.

As it's completely depend on their operating system API's and customisation. Even developers have requested for this on XIOMI's official forums but there is no response from there side.

直到现在,我什至没有找到这个问题的答案,但没有任何帮助.

Till now even i am finding an answer to this question but nothing helped me.

目前,只有植根电话才有可能.即通过成为超级用户来对其固件进行自定义. 但这是不可取的,因为它可能会损坏用户的手机.

For the time being it will be only possible for rooted phones. i.e. making customisation in their firmware by becoming super user. But this is not at all advisable as it may damage user's phone.

编辑1

您可以使用以下代码将用户重定向到自动启动权限的设置页面,以启用您的应用

You can redirect user to autostart permission's settings page for enabling your app using following code

String manufacturer = "xiaomi";
if (manufacturer.equalsIgnoreCase(android.os.Build.MANUFACTURER)) {
    //this will open auto start screen where user can enable permission for your app
    Intent intent1 = new Intent();
    intent1.setComponent(new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity"));
    startActivity(intent1);
}

编辑2 我最近使用了XIOMI的Mi A1,它有现货的android系统(不是miui),所以这部手机没有miui的autostart permission设置.因此,在将用户导航到此类设备中的设置时请多加注意,因为它将无法在此处使用.

EDIT 2 I have recently used Mi A1 from XIOMI which have stock android (not miui) so this phone does not have autostart permission settings from miui. So take care while navigating user to the settings in such devices because it will not work here.

这篇关于如何以编程方式检查MIUI自动启动权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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