Skip to content Skip to sidebar Skip to footer

Android Kitkat Sdcard Write Permission

In android KitKat there are some limitations for writing to SDcard. So my question: Is it always permitted to write to Environment.getExternalStoragePublicDirectory(Environment.DIR

Solution 1:

Is it always permitted to write to Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) even in KitKat?

If your app has requested the WRITE_EXTERNAL_STORAGE permission, then yes, as getExternalStoragePublicDirectory() points to external storage, which is not removable storage ("SDCard") on the vast majority of devices.

Solution 2:

You first need to understand concepts of Android Storage. Then you will understand that Environment.getExternalStorageDirectory() or something like that is about primary external storage. And it has nothing to do with Android APIs whether it is younger or older than KitKat.

Solution 3:

To get the internal SD card you can use

StringextStore= System.getenv("EXTERNAL_STORAGE");
Filef_exts=newFile(extStore);

To get the external SD card you can use

StringsecStore= System.getenv("SECONDARY_STORAGE");
Filef_secs=newFile(secStore);

On running the code

extStore = "/storage/emulated/legacy"secStore = "/storage/extSdCarcd"

works perfectly!

refer following Link , I think ur question has been answered already check this...

Android Open External Storage directory(sdcard) for storing file

Post a Comment for "Android Kitkat Sdcard Write Permission"