尝试startActivityForResult(intent,requestCode)时,我得到java.lang.SecurityException; with final Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS);意图.有趣的是,这次崩溃只发生在华为的Android 5.1 – 5.1.1上
我没有华为设备.你能告诉我它的建议吗?
堆栈跟踪
Fatal Exception: java.lang.SecurityException: Permission Denial: starting Intent { act=androID.settings.USAGE_ACCESS_SETTINGS cmp=com.androID.settings/.Settings$UsageAccessSettingsActivity } from ProcessRecord{11b5f1a1 19764:com.myproject.my/u0a167} (pID=19764, uID=10167) not exported from uID 1000 at androID.os.Parcel.readException(Parcel.java:1546) at androID.os.Parcel.readException(Parcel.java:1499) at androID.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:2448) at androID.app.Instrumentation.execStartActivity(Instrumentation.java:1496) at androID.app.Activity.startActivityForResult(Activity.java:3794) at androID.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:48) at androID.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:77) at androID.app.Activity.startActivityForResult(Activity.java:3755) at androID.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859) at com.myproject.my.utils.PermissionsHelper.onClick(PermissionsHelper.java:134) at androID.support.v7.app.AlertController$buttonHandler.handleMessage(AlertController.java:157) at androID.os.Handler.dispatchMessage(Handler.java:102) at androID.os.Looper.loop(Looper.java:135) at androID.app.ActivityThread.main(ActivityThread.java:5298) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:911) at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:706)
解决方法:
无论出于何种原因,华为都离开了< intent-filter>适用于此活动,但他们将其标记为未导出.您无法启动该活动.您所能做的就是捕获异常并向用户解释您无法在那里导航.
总结以上是内存溢出为你收集整理的java.lang.SecurityException:Permission Denial:启动Intent {act = android.settings.USAGE_ACCESS_SETTINGS全部内容,希望文章能够帮你解决java.lang.SecurityException:Permission Denial:启动Intent {act = android.settings.USAGE_ACCESS_SETTINGS所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)