I am trying to select a file from an external storage on Android 11. I got read and write permissions, as well as ActionManageAllFilesAccessPermission. It doesn't work
var file = await CrossFilePicker.Current.PickFile();
Help me please =(
For now, we use File Picker of Xamarin.Essentials
to pick a single or multiple files from the device.
Install Xamarin.Essentials NuGet package.
Update Android Manifest:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Replace:
var file = await CrossFilePicker.Current.PickFile();
To:
var file = await FilePicker.PickAsync(PickOptions.Default);
After allowing the permissions, you could pick the file you want.
For more details about the File Picker, please check the MS document. https://learn.microsoft.com/en-us/xamarin/essentials/file-picker?tabs=android