Reputation: 14834
I am very new to Android ecosystem. Can I make a definitive conclusion that any stored files in an external SD memory can be read by any apps?
Caution Although the directories provided by getExternalFilesDir() and getExternalFilesDirs() are not accessible by the MediaStore content provider, other apps with the READ_EXTERNAL_STORAGE permission can access all files on the external storage, including these. If you need to completely restrict access for your files, you should instead write your files to the internal storage. (http://developer.android.com/guide/topics/data/data-storage.html#filesExternal)
Upvotes: 0
Views: 1293
Reputation: 437
Yes you can, BUT there is an important piece of information you need to know if you are deploying the app on KitKat OS and above. You cannot no longer write at any location in the SD card/internal storage as it was done before. The public directories can still be written in(Downloads, Pictures, Videos, etc), but that's it. You can write to private storage for your app and your app can only read from it, BUT you won't be able to view that location or the file if you were browsing the contents of the sdCard. The only exception is if your phone was rooted.
http://www.androidcentral.com/kitkat-sdcard-changes
Example of writing to app private storage:
//Write to internal app storage
FileOutputStream internalStorage = null;
try
{
internalStorage = openFileOutput("capturedImage", Context.MODE_PRIVATE);
}
catch (FileNotFoundException e1)
{
e1.printStackTrace();
}
BufferedOutputStream buffer_output = new BufferedOutputStream(internalStorage);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, buffer_output);
try
{
buffer_output.flush();
buffer_output.close();
}
catch (IOException e)
{
e.printStackTrace();
}
Upvotes: 1