如何以编程方式检查 MIUI 自动启动权限?

编程入门 行业动态 更新时间:2024-10-27 00:29:15
本文介绍了如何以编程方式检查 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 和自定义.甚至开发者也在小米的官方论坛上提出要求,但那里没有任何回应.

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.

目前只有root手机才有可能.即通过成为超级用户在他们的固件中进行定制.但这一点也不可取,因为它可能会损坏用户的手机.

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我最近使用了小米的 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 自动启动权限?

本文发布于:2023-11-03 16:47:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555609.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自动启动   权限   方式   MIUI

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!