You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 15, 2024. It is now read-only.
Recently I started to use Xamarin.Essentials FilePicker for picking files from the file system. When using the FilePicker on Android (Android 10) I noticed that the permission prompt for the storage read permission didn't work properly: When choosing "Deny" from the prompt the file system is still opened, even though it shouldn't. From reading the source code (https://github.com/xamarin/Essentials/blob/main/Xamarin.Essentials/FilePicker/FilePicker.android.cs) it seems that the permission is only asked, but nothing is done with the result (line 19): await Permissions.RequestAsync<Permissions.StorageRead>();.
Steps to Reproduce
Bind the FilePicker PlatformPickAsync method to a button.
Run the application on an Android device (I did this on Android 10).
Press the button that has PlatformPickAsync bound to
From the permission prompt select "Deny"
Expected Behavior
File system doesn't open.
Actual Behavior
File system opens, even though it shouldn't have the right permission. User is still able to navigate the file system and pick files from it.
Basic Information
Version with issue: Xamarin.Essentials.1.6.0-pre3
Last known good version:
IDE: Visual Studio 2019 16.8.1
Platform Target Frameworks:
Android: 10
Affected Devices:
Samsung SM-G973F running Android 10 / One UI version 2.5
Nuget Packages: Xamarin.Essentials.1.6.0-pre3
Workaround
I was able to create a workaround by prompting the permission alert myself before using the FilePicker class' PlatformPickAsync method by using the Xamarin.Essentials Permission class. This didn't prompt a second permission alert from the FilePicker class on Android 10/Samsung SM-G973F, so it fit for my need at the moment.
The text was updated successfully, but these errors were encountered:
Description
Recently I started to use Xamarin.Essentials FilePicker for picking files from the file system. When using the FilePicker on Android (Android 10) I noticed that the permission prompt for the storage read permission didn't work properly: When choosing "Deny" from the prompt the file system is still opened, even though it shouldn't. From reading the source code (https://github.com/xamarin/Essentials/blob/main/Xamarin.Essentials/FilePicker/FilePicker.android.cs) it seems that the permission is only asked, but nothing is done with the result (line 19): await Permissions.RequestAsync<Permissions.StorageRead>();.
Steps to Reproduce
Expected Behavior
File system doesn't open.
Actual Behavior
File system opens, even though it shouldn't have the right permission. User is still able to navigate the file system and pick files from it.
Basic Information
Workaround
I was able to create a workaround by prompting the permission alert myself before using the FilePicker class' PlatformPickAsync method by using the Xamarin.Essentials Permission class. This didn't prompt a second permission alert from the FilePicker class on Android 10/Samsung SM-G973F, so it fit for my need at the moment.
The text was updated successfully, but these errors were encountered: