Hello,
- After I choose “allow”, permission dialog closed, the file chooser didn't appear until I close the app and run it again, and what I wanted is: when user grand permission the file chooser appear immediately.
Because you cannot pop up two windows that come from android system at same time. These operations need to be executed separately.
Why do you request camera permission in OnShowFileChooser
method?
You can move request camera code to OnCreate
method of MainActivity.cs
If user tap "Don't ask again", can I check this status and open app's permission setting dialog for user?
Yes, You can use Activity.ShouldShowRequestPermissionRationale(Manifest.Permission.Camera);
to check the status.
This method returns true if the app has requested this permission previously and the user denied the request. That indicates that you should probably explain to the user why you need the permission.
If the user turned down the permission request in the past and chose the Don't ask again option in the permission request system dialog, this method returns false. The method also returns false if the device policy prohibits the app from having that permission.
For more information, you can check this request documentation.
You can tell users how to grant this permission manually and open the app's permission page in Setting
page by following code.
int REQUEST_PERMISSION_SETTING = 10022;
Intent intent = new Intent(Android.Provider.Settings.ActionApplicationDetailsSettings);
Android.Net.Uri uri =Android.Net.Uri.FromParts("package", PackageName, null);
intent.SetData(uri);
StartActivityForResult(intent, REQUEST_PERMISSION_SETTING);
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.