API 29 update introduced some incompatibilities with our existing sample app. For example:
Environment.getExternalStorageDirectory() is now deprecated in favor of Context#getExternalFilesDir(String). See Android docAndroidManifest to request legacy external storage accessInvestigate further to find more changes to be made.
Also note item 3: https://aws-amplify.github.io/docs/sdk/android/storage#connect-to-your-backend
@jpignata @raphkim I don't think adding android:requestLegacyExternalStorage to AndroidManifest.xml (item 3 in the docs) is the best approach here. The purpose of this flag is to allow developers to migrate data from external storage into scoped storage while they are targeting API 29, but once you are targeting Android 11 (API 30 I think), this flag no longer works. Can you confirm if my understanding is correct?
@richardmcclellan , yes I fully agree with you. The documentation I added was a temporary workaround to accommodate existing apps (such as our sample app) that are already built to use the legacy storage. However, the ideal solution would be to use scoped access and not rely on deprecated legacy storage at all if API>29 is detected.
Resolving as https://github.com/awslabs/aws-sdk-android-samples/pull/336 has been merged.
Most helpful comment
@jpignata @raphkim I don't think adding
android:requestLegacyExternalStoragetoAndroidManifest.xml(item 3 in the docs) is the best approach here. The purpose of this flag is to allow developers to migrate data from external storage into scoped storage while they are targeting API 29, but once you are targeting Android 11 (API 30 I think), this flag no longer works. Can you confirm if my understanding is correct?