isExternalStorageLegacy is false when update android system from 10 to 11

Viewed 191

On my project manifest file

    android:preserveLegacyExternalStorage="true"
    android:requestLegacyExternalStorage="true"

we have a migration scenario for scope storage. we are using legacy storage on android 10 but we want to migrate when version updated to 11.

we have install app on a android 10 device. Later we have updated to android system 11. when we launch app Environment.isExternalStorageLegacy()

return false

android:preserveLegacyExternalStorage is true but return false . do you have any reason for this?

1 Answers

Because Android 11 does not accept legacy storage as seen below. System is ignore your android:requestLegacyExternalStorage="true" field.

Caution: After you update your app to target Android 11 (API level 30), the system ignores the requestLegacyExternalStorage attribute when your app is running on Android 11 devices, so your app must be ready to support scoped storage and to migrate app data for users on those devices. Android Data Storage

Related