"SD Card" permission appears on 2.0 devices?
I wrote an Android application. These are the permissions I requested:
- INTERNET
- ACCES开发者_运维百科S-COARSE-LOCATION
- ACCESS-FINE-LOCATION
- ACCESS-NETWORK-STATE
- CHANGE-NETWORK-STATE
On 1.5 devices, it looks fine. I tried on a 2.0 device, and it also shows an additional permission when installing the app:
- SD CARD READ / WRITE
Is that just coming up by default now on any 2.0 device we install apps on? I do use Context.openFileOutput()
to write a file to disk, but only to the app sandbox location, never to SD card.
Thanks
From the API docs, applications targeting DONUT or higher:
...must explicitly request the
WRITE_EXTERNAL_STORAGE
permission to be able to modify the contents of the SD card. (Apps targeting earlier versions will always request the permission.)
Hence, if you are building a 1.5 app, you automatically get WRITE_EXTERNAL_STORAGE
.
I think reading from the SDcard is always allowed, but for writing you need WRITE_EXTERNAL_STORAGE permission, maybe "SD CARD READ / WRITE" is just another translation for that on the device, since it more human readable.
精彩评论