Android apps targeting Android 11 (API level 30) can no longer use the requestLegacyExternalStorage attribute. This impacts apps that want to open a file chooser with a fileUrl directed at a file within the app's own storage. Explicit permission needs to be granted to the Action View Intent through the Intent.FLAG_GRANT_READ_URI_PERMISSION flag.
This article gives a good explanation on this flag and how it should be used.
The code below would not work for an app with requestLegacyExternalStorage disabled prior to this PR.
Android apps targeting Android 11 (API level 30) can no longer use the
requestLegacyExternalStorage
attribute. This impacts apps that want to open a file chooser with afileUrl
directed at a file within the app's own storage. Explicit permission needs to be granted to the Action View Intent through theIntent.FLAG_GRANT_READ_URI_PERMISSION
flag.This article gives a good explanation on this flag and how it should be used.
The code below would not work for an app with
requestLegacyExternalStorage
disabled prior to this PR.