I'm trying to solve a problem, my App in xamarin needs the camera in a View. When the App is opened, it asks for the permissions (if the user grants the permissions, everything is fantastic), if the user rejects them, when entering the view, I put a button to request the permissions again, but it does not work. The famous poster does not appear of android requesting access. and another strange thing is that if I close the App I see the request for permission again -you only see the android message requesting permission, my app is no longer seen and is closed- Someone can guide me what may be happening
Button code:
private void BtnSolicitarAccesoCamara_OnClick(object sender, System.EventArgs e)
{
Task.Factory.StartNew(async () =>
{
if (Plugin.Permissions.CrossPermissions.IsSupported)
{
var result = await Plugin.Permissions.CrossPermissions.Current.CheckPermissionStatusAsync(Plugin.Permissions.Abstractions.Permission.Camera);
if (result != Plugin.Permissions.Abstractions.PermissionStatus.Granted)
{
var rp = await Plugin.Permissions.CrossPermissions.Current.RequestPermissionsAsync(Plugin.Permissions.Abstractions.Permission.Camera);
}
}
});
}
MainActivity
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] global::Android.Content.PM.Permission[] grantResults)
{
PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
global::ZXing.Net.Mobile.Android.PermissionsHandler.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}