MIUI Permission Denied Activity KeyguardLocked

帅比萌擦擦* 提交于 2020-07-05 08:07:30

问题


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?


回答1:


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)



来源:https://stackoverflow.com/questions/56295901/miui-permission-denied-activity-keyguardlocked

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