您的位置:首页 > 其它

读外部存储的权限READ_EXTERNAL_STORAGE

2016-06-22 15:03 375 查看

READ_EXTERNAL_STORAGE

Added in API level 16
String READ_EXTERNAL_STORAGE
Allows an application to read from external storage.

Any app that declares the
WRITE_EXTERNAL_STORAGE
permission is implicitly granted this permission.

This permission is enforced starting in API level 19. Before API level 19, this permission is not enforced and all apps still have access to read from external storage. You can test your app with the permission enforced by enabling Protect USB storage under Developer options in the Settings app on a device running Android 4.1 or higher.

Also starting in API level 19, this permission is not required to read/write files in your application-specific directories returned by
getExternalFilesDir(String)
and
getExternalCacheDir()
.

Note: If both your
minSdkVersion
and
targetSdkVersion
values are set to 3 or lower, the system implicitly grants your app this permission. If you don't need this permission, be sure your
targetSdkVersion
is 4 or higher.

Protection level: dangerous

Constant Value: "android.permission.READ_EXTERNAL_STORAGE"

已经声明了写外置存储的权限WRITE_EXTERNAL_STORAGE,则隐式的赋予了读外置存储权限。
所以,在系统自带app媒体存储MediaProvider的AndroidManifest.xml中未显式声明读权限,因为已经声明了写权限:

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_MTP" />
<uses-permission android:name="android.permission.MANAGE_USERS" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
http://androidxref.com/6.0.1_r10/xref/packages/providers/MediaProvider/AndroidManifest.xml

官网:https://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGE
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: