Reference

getExternalFilesDir()

An Android Context method returning an app-specific directory on external/shared storage. Files here belong to the app, need no storage permission, and are deleted automatically when the app is uninstalled — but they still count toward the app's storage footprint.

Android developmentAndroid

getExternalFilesDir()

Also known as: external files dir android, app external files, android getexternalfilesdir, Context getExternalFilesDir

An Android Context method returning an app-specific directory on external/shared storage. Files here belong to the app, need no storage permission, and are deleted automatically when the app is uninstalled — but they still count toward the app's storage footprint.

  • Returns an app-owned path under Android/data/<package>/files on shared storage.
  • No storage permission required and not blocked by scoped storage.
  • Auto-deleted on uninstall; still counts toward the app's storage footprint.

Where it points and why it is special

Context.getExternalFilesDir(String type) returns a path like /storage/emulated/0/Android/data/<package>/files/, an app-private area on the external (shared) volume. Passing null gives the root files folder, or you can request typed subdirectories such as Environment.DIRECTORY_PICTURES or DIRECTORY_MOVIES.

Unlike truly shared locations, this directory needs no runtime storage permission and is exempt from scoped-storage restrictions, because the OS treats it as owned by your app. Use it for large, app-specific files like downloaded media, exports, or generated caches that other apps do not need to see.

Lifecycle and cleanup

The key property: when the app is uninstalled, everything under its Android/data/<package>/ tree, including getExternalFilesDir(), is deleted by the system automatically. There is no need to clean up on the user's behalf at uninstall time, but the data does count toward the app's reported storage size while installed.

This is also why these folders show up in storage cleaners. Files an app stuffed into Android/data can grow large and linger; the cleaner surfaces leftover app folders and the android-data-folder so users can reclaim space without digging through the file system manually.

Related terms

Keep reading the reference.

Act on it

Guides and tools for this topic.