Lorixen.
EN

Android app can't save files where users can find them?

Short answer: Modern Android versions limit where apps can write: files saved to your app's own folders are hidden from users and deleted when the app is uninstalled, and the old trick of writing anywhere with a storage permission no longer works. To save photos, videos or audio where people can see them, add them through the MediaStore. To save PDFs or exports to Downloads, use the MediaStore Downloads collection or let the user pick a location with the system "save as" screen (Storage Access Framework). Neither route needs a storage permission on current Android versions.

Why saving files broke

Older apps often requested a storage permission and wrote straight into a folder such as /sdcard/MyApp/. Since Android 10, apps that target newer versions use scoped storage, which restricts direct access to shared folders. Android's guidance on permissions shows the old write permission being declared only up to API level 29, Android 10, which tells you it no longer applies above that.

Typical symptoms after an update:

  • Saving fails with a permission or "file not found" error.
  • Saving appears to succeed, but users can't find the file in Files, Gallery or Downloads.
  • Files disappear when the user reinstalls the app.
  • Play Console or reviewers question a broad storage permission.

Know the two kinds of storage

Android's data storage overview describes several options, and two matter here:

  • App-specific storage: folders that belong to your app. No permission needed, but intended for your app's own use, and removed when the app is uninstalled. Right for caches, drafts and temporary files.
  • Shared storage: media, documents and other files intended to be shared with other apps. These remain after uninstall.

If users should be able to open, share or keep a file, it belongs in shared storage.

Photos, videos and audio: the MediaStore

Android's documentation describes the media store as an index of media collections that lets apps add and retrieve media files, which remain on the device even after the app is uninstalled. On Android 10 and higher, an app doesn't need storage permissions to create and modify media files it owns, for example photos it saves.

The pattern:

  1. Create an entry in the relevant collection (images, video or audio) with a display name, type and optionally a relative path such as Pictures/YourBusiness.
  2. Open an output stream on the returned address and write the file.
  3. For larger files, mark the item as pending while writing. The docs describe setting IS_PENDING to 1 so only your app can see the file, then back to 0 when it's complete, which stops a gallery showing a half-written video.

Documents and exports: two good options

MediaStore Downloads

The docs note that on Android 10 and higher, files in the Download/ directory are stored in the MediaStore.Downloads collection, and that your app doesn't need storage permissions to access files it created there. That makes it a good default for invoices, reports and tickets: users find them in the Downloads section of their file manager.

Let the user choose: Storage Access Framework

For "save as" behaviour, use the system's document picker. Android's documentation describes the ACTION_CREATE_DOCUMENT intent, which lets users save a file to a specific location, including cloud drives that integrate with the picker. Because the user chooses the location, the docs explain this needs no system permissions, and the files stay after the app is uninstalled. ACTION_OPEN_DOCUMENT does the same for opening files.

This is the best choice when users have different preferences, for example saving job reports straight to a shared business drive.

Often better: just share it

If the user's real goal is to send the file to someone, the share sheet may be all you need. Generate the file in app-specific storage, then share it through a content provider. The user can email it, save it to a drive or open it in a PDF viewer, and your app doesn't manage shared folders at all.

Avoid the "all files" permission

Android has a permission that grants broad access to all files, intended for apps like file managers and backup tools. Business apps that save the occasional PDF don't need it, and Google Play restricts which apps may request it. Requesting it is likely to cause review problems.

Test on several versions

Behaviour differs by Android version, so test:

  • an older device or emulator (Android 9 or earlier), where the old permission may still be needed for writing
  • a current version, saving to MediaStore and through the picker
  • reinstalling the app, confirming shared files remain and app-specific files don't

Check where files appear in the Files app and the gallery, because that's where users will look.

Tell users where files went

A short confirmation after saving, such as "Saved to Downloads" with an "Open" button, prevents most support questions. If you use the picker, the user already knows where it went.

A worked example

An illustrative Tauranga field service company's Android app let technicians save job reports as PDFs. After an update targeting a newer Android version, saves failed on most phones, and where they worked, files vanished on reinstall. The developer switched report saving to the MediaStore Downloads collection, added a "Save as" option using the system picker for technicians who wanted reports in a shared drive, removed the old storage permission for newer Android versions, and added a "Saved to Downloads" confirmation. Support requests about missing reports stopped.

FAQ

Do I need storage permissions at all?

For saving your own files on current Android versions, usually not. Reading other apps' files needs different, more specific permissions.

Why can't users see files in my app's folder?

App-specific storage is meant to be private to your app and is removed on uninstall.

Can I create my own folder in Downloads?

You can set a relative path within Downloads when adding a file through the MediaStore.

What about iOS?

iOS uses a different model: save via the document picker, the share sheet or your app's Files folder.

If your Android app's saving or exporting broke after an update, tell us what it needs to save and we'll recommend the right approach.

Sources

WhatsAppBook a call