Skip to content

Instantly share code, notes, and snippets.

@milosjovac
Last active February 17, 2016 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milosjovac/f205bcd1fa87df205d14 to your computer and use it in GitHub Desktop.
Save milosjovac/f205bcd1fa87df205d14 to your computer and use it in GitHub Desktop.
// PRIVATE - no need for permissions here
// private dir in internal storage:
Context.getFilesDir(); // system doesn't clean this memory, put sensitive user data here. Not even user can read this files
Context.getCacheDir(); // system will clear this when low on memory
// (app specific) private dir in "external"(readable by all apps with READ/WRITE_EXTERNAL_STORAGE_PERMISSION) storage
Context.getExternalFilesDir();
Context.getExternalFilesDirs(); // plural! As of KitKat it returns "external" directory folder, but also one from the SD card
Context.getExternalCacheDir();
Context.getExternalCacheDirs(); // same here
Context.getExternalMediaDirs(); // added in Lollipop, add here files you want to be read by medi scanner
// for game developers and in purpose of expension files
obb directory // shared across all users
// PUBLIC - survives app being uninstalled
// not deleted when "Cleare data and clear cache" is cleared in Settings
// (user specific) public user dir in "external" storage directory
Environment.getExterenalStorageDirectory() // root, kao C:\
Environment.getExterenalStoragePublicDirectory(String) //
Should I need the storage permission? http://prntscr.com/8wvabi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment