Is there any convention for storing Android SD cards?

After installing many applications and creating several of them, I’m sure that many people asked this question. If I look at my SD card, it looks absolutely horrible, and it’s very difficult to find folders that are mine to put music / video / images between all folders for different applications.

Are there any agreements that we developers should try to put their applications in the same base folder, or has Google completely forgotten about this?

+4
source share
2 answers

From reference :

Applications should not directly use this top-level directory so as not to pollute the root username space. Any files that are private to the application must be placed in the directory returned by Context.getExternalFilesDir , which the system will take care of removal if the application is deleted. Other shared files must be placed in one of the directories returned by getExternalStoragePublicDirectory (String).

+6
source

I am extending the application class in my application and have the following ...

protected static File myAppDir = null; 

Then in onCreate () (in the app) ...

 if (myAppDir == null) myAppDir = new File(getExternalFilesDir(null).getAbsolutePath()); 

This automatically creates /mnt/sdcard/Android/data/com.mycompany.myApp/files if it does not exist. You can specify parameters other than "null" to getExternalFilesDir () for things like images, videos, etc.

+1
source

All Articles