MIUI Permission Denied Activity KeyguardLocked
Asked Answered
D

1

12

When application is in background and screen is locked,I'm unable to start activity, there is no exception or warning, onCreate() is just not called. I've been struggling against this problem for while, and I think I've finally found the source of it. There is a line in logs:

D/com.android.server.am.ExtraActivityManagerService: MIUILOG- Permission Denied Activity KeyguardLocked: Intent { flg=0x14010000 cmp=com.trueconf.videochat/com.trueconf.gui.activities.Call (has extras) } pkg : com.trueconf.videochat uid : 10634

Is this why I can't start an activity? Also, how do I solve this, should I disable keyguard or something?

Downer answered 24/5, 2019 at 15:50 Comment(0)
R
19

This is a special permission on MIUI that has to be enabled for apps.

You can find it in

  1. Settings
  2. Manage Apps
  3. YOUR APP
  4. Other permissions
  5. Show on Lock screen

User must enable this manually. As far as I know, the best you can do is to guide the user to this settings menu directly by launching an intent (and probably showing some explainer text prior to this).

Intent looks like this

startActivity(new Intent("miui.intent.action.APP_PERM_EDITOR").putExtra("extra_pkgname", getPackageName()))

Make sure to try catch it as it can throw exceptions if activity can't be started (e.g. the device actually is not running MIUI or the intent is somehow not valid on the particular device/version)

Resignation answered 13/6, 2019 at 9:45 Comment(3)
Thanks, but how can I check if this permission is enabled?Downer
As far as I know, you can't, unfortunately.Resignation
Also could be needed the permission "Display pop-up windows while running in the background", as in https://mcmap.net/q/1008486/-miui-permission-denied-while-trying-to-start-action_send-action_view-intent. For me, enabling that one and having "Show on Lock screen" disabled worked. Maybe because I have the lock screen disabled at all...Ellen

© 2022 - 2024 — McMap. All rights reserved.