App compatibility features for data storage

To help you support the latest versions of Android, the platform provides the following app compatibility feature for data storage.

Temporarily opt-out of scoped storage

Before your app is fully compatible with scoped storage, you can temporarily opt out by using one of the following methods:

  • Target Android 9 (API level 28) or lower.
  • If you target Android 10 (API level 29) or higher, set the value of requestLegacyExternalStorage to true in your app's manifest file:

    <manifest ... >
      <!-- This attribute is "false" by default on apps targeting
           Android 10 or higher. -->
        <application android:requestLegacyExternalStorage="true" ... >

To test how an app targeting Android 9 or lower behaves when using scoped storage, you can opt in to the behavior by setting the value of requestLegacyExternalStorage to false.