We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public static async Task AskForRequiredPermission() { try { var canRequestInstallPackage = true; if (Build.VERSION.SdkInt >= BuildVersionCodes.O) canRequestInstallPackage = Platform.CurrentActivity.PackageManager.CanRequestPackageInstalls();
if (!canRequestInstallPackage) { Platform.CurrentActivity.StartActivity(new Intent( Android.Provider.Settings.ActionManageUnknownAppSources, Android.Net.Uri.Parse("package:" + Android.App.Application.Context.PackageName))); } var writeStatus = await Permissions.CheckStatusAsync<Permissions.StorageWrite>(); if (writeStatus != PermissionStatus.Granted) { **await Permissions.RequestAsync<Permissions.StorageWrite>();** } writeStatus = await Permissions.CheckStatusAsync<Permissions.StorageWrite>(); var readStatus = await Permissions.CheckStatusAsync<Permissions.StorageRead>(); if (readStatus != PermissionStatus.Granted) { **await Permissions.RequestAsync<Permissions.StorageRead>();** } readStatus = await Permissions.CheckStatusAsync<Permissions.StorageRead>(); if (writeStatus == PermissionStatus.Granted && readStatus == PermissionStatus.Granted && canRequestInstallPackage) return true; } catch (Exception ex) { //Something went wrong } return false; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
public static async Task AskForRequiredPermission()
{
try
{
var canRequestInstallPackage = true;
if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
canRequestInstallPackage = Platform.CurrentActivity.PackageManager.CanRequestPackageInstalls();
The text was updated successfully, but these errors were encountered: