12

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?

Mo Dev
  • 475
  • 6
  • 17

2 Answers2

10

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 checked or not programmatically...

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?...

Zohar
  • 1,820
  • 1
  • 18
  • 16
  • Good question. I'm still looking for a way to check if the permission was granted – Natan Lotério Apr 23 '20 at 17:53
  • @NatanLotério are you get any solution for check permission is granted or not because i am also looking for this solution – Raj Gohel Jun 18 '20 at 09:55
  • Hi @RajGohel sorry for the late response. No, we didn't find a good way to do this. So we are asking the user to check it manually. – Natan Lotério Jul 06 '20 at 19:14
  • 1
    @NatanLotério But have you find a way to check user give manually permission or not because if user give permission manually second time we should not ask user to give permission right? – Raj Gohel Jul 07 '20 at 12:35
  • I have also open dialog where user can click and move to permission screen and enable permission but dialog open every time how you check user give permission or not – Raj Gohel Jul 07 '20 at 12:37
  • No, we check if the SO is MIUI so then, we show the settings screen sending an intent for 'ACTION_APPLICATION_DETAILS_SETTINGS' . The user must verify if the permission was granted by himself. – Natan Lotério Jul 07 '20 at 13:07
  • Any luck of finding a way to check if this permission enabled? – Royz Oct 21 '20 at 09:42
0

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

BennyP
  • 1,737
  • 1
  • 18
  • 24