且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android-如何在小米设备中以编程方式启用自动启动选项?

更新时间:2022-12-26 20:02:42

如果小米OS希望将其从Playstore下载该应用程序,则该功能会自动启用,因为小米OS希望将其用作亚马逊,谷歌IO等应用程序自动启动,在这种情况下,您必须转到安全权限->自动启动->然后从此处启用自动启动.您无法通过代码使应用程序自动启动,只能显示一个对话框来启用自动启动并将用户引导至自动启动活动,但这不是一个好选择,因为您无法检查是否已启用自动启动. Mi在MIUI8中这样做是为了节省电池.此问题浪费了我2天的XD

The autostart feature will get enabled automatically when you will download the app from playstore if xiaomi OS wants it as apps like amazon ,google IO etc are also not allowed to autostart ,In this case you have to go to Security permissions -> autostart -> then enable autostart from there.You cannot make the app autostart by code all you can do is you can show a dialog to enable auto start and take the user to the autostart activity but this is not a good option as you cannot check whether autostart is enabled or not. This is done by Mi in MIUI8 for saving battery .This issue wasted my 2 days XD

您可以参考 查看全文