Aws-sdk-android: Account for API 29 changes to storage access in S3TransferUtility Sample App

Created on 19 Feb 2020  路  5Comments  路  Source: aws-amplify/aws-sdk-android

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 doc
  • Android apps now have scoped access to the storage and requires additional parameter to be specified inside AndroidManifest to request legacy external storage access

Investigate further to find more changes to be made.

S3 Sample App

Most helpful comment

@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?

All 5 comments

@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.

Was this page helpful?
0 / 5 - 0 ratings