Android Marshmallow permission model on OS 4.0 READ_EXTERNAL_STORAGE permission always not granted

风格不统一 提交于 2019-12-04 00:55:54

What ActivityCompat.requestPermissions() does is:

  • call through to the real requestPermissions() if you are on Android 6.0+, or

  • use PackageManager to see if you hold the requested permissions on older versions of Android

The problem with READ_EXTERNAL_STORAGE is that it was added in API Level 16 (Android 4.1). You cannot hold it on older versions of Android than that, for the simple reason that it did not exist.

Either:

  • Set your minSdkVersion to 16, or

  • Put your own logic in to handle this case, recognizing that READ_EXTERNAL_STORAGE is irrelevant prior to API Level 16

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