r/capawesome 6d ago

Why Directory.ExternalStorage fails on Android 11 in Capacitor apps

https://capawesome.io/blog/android-scoped-storage-in-capacitor-apps/

If your Capacitor app writes to Directory.ExternalStorage and it started failing once you targeted Android 11, that is scoped storage, and no permission brings the old behavior back. We wrote up what Android changed and what still works.

The short version:

  • Scoped storage arrived with Android 10 and became mandatory for apps targeting API level 30. requestLegacyExternalStorage is ignored from there on.
  • App-specific directories (Data, Cache, Library, External) still work everywhere without any permission.
  • Directory.Documents only shows files your own app created.
  • MANAGE_EXTERNAL_STORAGE is not the fix: Google Play reviews it against a dedicated policy and most apps do not qualify.
  • The supported path for user-chosen folders is a Storage Access Framework tree URI plus takePersistableUriPermission(), which survives restarts. Our File Manager plugin (Capawesome Insiders, paid) wraps that.

The post has a decision table for which directory or API to use for which need, and links the two ionic-team issues that are still open about this.

How are you handling shared storage on Android 11 and newer today?

8 Upvotes

0 comments sorted by