Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
510 views
in Technique[技术] by (71.8m points)

android - Google Play shows the implicit READ_EXTERNAL_STORAGE permission

When Android 4.1 JellyBean (API 16) was announced at Google I/O, it introduced the following permission:

READ_EXTERNAL_STORAGE

Provides protected read access to external storage. In Android 4.1 by default all applications still have read access. This will be changed in a future release to require that applications explicitly request read access using this permission. If your application already requests write access, it will automatically get read access as well. There is a new developer option to turn on read access restriction, for developers to test their applications against how Android will behave in the future.

http://developer.android.com/about/versions/android-4.1.html#Permissions

I have an application that tagets API 16 and requires the WRITE_EXTERNAL_STORAGE permission. I am preparing to deploy an update and noticed that the READ_EXTERNAL_STORAGE permission is now listed as a required permission in the developer portal. It was not listed as a required permission in Google Play for an update deployed last week. This application does not explicitly request the READ_EXTERNAL_STORAGE permission.

Will users who have already granted the WRITE_EXTERNAL_STORAGE permission for this application be prompted to grant the additional, implicit READ_EXTERNAL_STORAGE permission when they update the application?

Update:

We have since released the app and JellyBean devices are automatically updating without requesting the READ_EXTERNAL_STORAGE permission. In a future release when I explicitly declare the requirement for READ_EXTERNAL_STORAGE, will users who have already granted the WRITE_EXTERNAL_STORAGE permission be asked to grant the READ_EXTERNAL_STORAGE permission?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You won't have to explicitly declare READ_EXTERNAL_STORAGE so long as you have WRITE_EXTERNAL_STORAGE. Previously the OS didn't enforce readonly access to the external storage, that is changing and you must request it now. But if you have write access you implicitly get read access.

From http://developer.android.com/training/basics/data-storage/files.html

If your app needs to read the external storage (but not write to it), then you will need to declare the READ_EXTERNAL_STORAGE permission ...

However, if your app uses the WRITE_EXTERNAL_STORAGE permission, then it implicitly has permission to read the external storage as well.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...