标签 android.permission.READ_PHONE_STATE 下的文章

异常信息如下:

java.lang.SecurityException: getDeviceId: Neither user 10065 nor current process has android.permission.READ_PHONE_STATE.

原因:动态权限的问题
Android 6.0 (API Level 23) 及以后引入了运行时权限,安装 APP 时不再授予所有需要的权限,而是在运行的时候根据需要向用户请求权限,而且用户可以随时取消已经授予的权限。

推荐开源库:

GitHub 上有个对开源库 https://github.com/googlesamples/easypermissions 进行二次封装的开源库 https://github.com/forJrking/HeiPermission 还不错,可以尝试下。

参考链接:
http://blog.csdn.net/github_33304260/article/details/53328297
https://developer.android.com/training/permissions/requesting.html

免责声明
本博客部分内容来自于互联网,不代表作者的观点和立场,如若侵犯到您的权益,请联系[email protected]。我们会在24小时内进行删除。