Xiaomi devices permission to enable apps pop-up windows while running in the background

拈花ヽ惹草 提交于 2021-02-04 13:47:02

问题


Xiaomi devices latest update introduced a new permission that prevents my app (custom shortcuts launcher) that works in the background from working untill users enable this permission: ""Display pop-up windows while running in the background"

The question is, how can I show a permission prompt window for this permission, or at least how to redirect users to "other permissions" screen?


回答1:


To redirect users to the "other permissions" screen use this code

        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);

Source

Still looking for a way to tell if this option is check or not prgrammatically...

What's more interesting is, how some apps have managed to have this option checked before any user interaction... maybe there is some secret miui permission?...




回答2:


This permission is added automatically by Google Play and isn't granted on local builds, not even release builds

if you target SDK version 30 and compile with 30, Google Play will give you the permission

   compileSdkVersion 30
   targetSdkVersion 30

note: I targeted 28 and it didn't work for me



来源:https://stackoverflow.com/questions/59418504/xiaomi-devices-permission-to-enable-apps-pop-up-windows-while-running-in-the-bac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!