Reference

requestLegacyExternalStorage

requestLegacyExternalStorage is a manifest flag that let apps temporarily opt out of scoped storage and keep using raw file paths on Android 10. It is ignored on Android 11+, where scoped storage is always enforced.

Android developmentAndroid

requestLegacyExternalStorage

Also known as: legacy external storage, opt out scoped storage, requestlegacyexternalstorage

requestLegacyExternalStorage is a manifest flag that let apps temporarily opt out of scoped storage and keep using raw file paths on Android 10. It is ignored on Android 11+, where scoped storage is always enforced.

  • A manifest attribute on the <application> tag, honored only on Android 10 (API 29).
  • Ignored on Android 11+ (API 30 and above); scoped storage is mandatory there.
  • preserveLegacyExternalStorage only carries an existing legacy state through an update, not a new install.

What the flag did

android:requestLegacyExternalStorage="true" is an attribute on the <application> element of AndroidManifest.xml. On Android 10 (API 29) it told the system to keep the app on the old filesystem model, so it could read and write the shared external storage by raw path (for example via java.io.File) instead of going through scoped storage and the MediaStore / Storage Access Framework APIs.

The flag was a migration aid, not a permanent escape hatch. Apps that targeted API 29 could request it to buy time, but Google made clear it was opt-out only for a single release while developers updated their storage code.

Why it stops working and what replaces it

On Android 11 (API 30) and later, the system ignores requestLegacyExternalStorage for any app, and apps that target API 30+ always run under scoped storage. The related preserveLegacyExternalStorage flag only preserves an existing legacy state across an in-place update to API 30; it does not grant fresh legacy access on a clean install.

This is why older cleaner apps that relied on raw path scanning lost reach: under scoped storage they must use MediaStore for media, Storage Access Framework trees for other folders, and for broad cleanup the MANAGE_EXTERNAL_STORAGE ('All files access') permission, which is gated by Play policy. If a cleaner suddenly cannot see files it used to, an obsolete reliance on this flag is a common cause.

Related terms

Keep reading the reference.

Act on it

Guides and tools for this topic.