In Android 4.4 , if both the body storage and the SD card are used, the application will not be able to create, modify or delete data in the SD card. However, the application can still write data to any directory in the primary storage (body storage) without any restrictions.
Google says the purpose of this is to allow the system to purge legacy files after the application has been uninstalled by restricting it in this way. For example, you can't use the cool music box to download and save Mp3 to an external memory card, or you can't use the fast-read free novel to save the TXT version of the novel to an external memory card.
in the The "External storage technology information" document in the Android developer site describes:
write_external_storage only grant Write permissions to the primary external storage on the device, the application cannot write data to level two external storage devices unless the comprehensive permissions specify the package directory of the application.
This currently only affects dual storage devices, if your device has internal storage space, which is commonly referred to as the body storage, then your SD card is a level two external storage device.
So why do Android 4.4 restrict SD card read and write?
This is actually a misunderstanding, and when you read the following description you will find that Android 4.4 is enhanced with support for the SD card.
Define several terms first to avoid ambiguity:
Internal storage: refers to the/data partition.
External storage: refers to the/sdcard partition.
Consolidated storage: refers to a directory in which/sdcard actually points to the/data partition, both physically sharing storage space.
SD card: refers to the small storage card that can be physically removed
Android support for SD cards:
Android 2.1 and previous versions, do not support merge storage, SD card as external storage, app can only be installed to internal storage.
Android 2.2, does not support the consolidation of storage, SD card as external storage, considering that some models of internal storage is relatively small, so the installation/mobile application to external storage features.
With Android 3.0, a consolidated storage solution is supported and recommended. Models that do not use the merge storage scheme can still follow the previous version of the scenario (see previous entry). For models with a consolidated storage scheme, installing an application to external storage is equivalent to installing it to internal storage (so there is no "move to external storage/internal storage" option on the interface), the phone can still be equipped with an SD card, but the SD card is read-only for third-party applications, Only media files can be read by Mediaprovider exposed to users and apps.
On Android 4.4, models with a consolidated storage plan can be equipped with an SD card, and third-party applications can read and write their own private data area on the SD card via the public API (similar to/data/data/[package name] or/sdcard/android/data/[ Package name], or you can read other files on the SD through the exposed API.
It can be seen that Android support for SD card is stepping up, and the "Android 4.4 limited SD card" is generated. The root of the misunderstanding was that before Android 4.4, many handset makers had to rewrite Android for both external storage and SD cards, giving third-party apps full access to the SD card, which, when Android 4.4, had to comply with Google's request to shut down this privilege.
It should be explained that in Android 4.4, the System application (refers to the platform signature, or pre-installed in the/system/priv-app directory) can get full access to the SD card by using write_media_storage permissions.
Add: In order to ensure that the legacy application of the read-write SD card (legacy applications) works properly, some manufacturers will disregard the original Android 4.4 design, and by modifying the packet strategy on Android 4.4 is also given the use of Write_external_ The storage Permission program fully reads and writes the SD card permissions.
Android 5.0 cannot be streamed directly to the external sdcard destination path URL to write data, must be implemented through Support.v4.provider.DocumentFile, you can send Intent.action_open_document_tree, dynamically grants read and write permissions to the SDcard directory tree.
Android 6.0 also needs to apply for an external sdcard read and write permission first. in Android6.0, third-party apps are no longer added to the Sdcard_r and SDCARD_RW groups. Instead, you implement access control for external storage by mounting the appropriate runtime views to your app.
Android external SDcard Read and Write permissions summary