Commit fd68c25f authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Do not use permission API if android < 23

parent 7f2a9a28
......@@ -13,7 +13,7 @@ using System.Collections.Generic;
using Xamarin.Forms;
using Android.Views;
using Android.Widget;
using System.Security.AccessControl;
using System;
namespace Xamarin.Droid
{
......@@ -97,18 +97,21 @@ namespace Xamarin.Droid
protected override void OnResume()
{
base.OnResume();
List<string> Permissions = new List<string>();
if (this.CheckSelfPermission(Manifest.Permission.Camera) != Permission.Granted)
if (Int32.Parse(global::Android.OS.Build.VERSION.Sdk) >= 23)
{
Permissions.Add(Manifest.Permission.Camera);
}
if (this.CheckSelfPermission(Manifest.Permission.RecordAudio) != Permission.Granted)
{
Permissions.Add(Manifest.Permission.RecordAudio);
}
if (Permissions.Count > 0)
{
this.RequestPermissions(Permissions.ToArray(), PERMISSIONS_REQUEST);
List<string> Permissions = new List<string>();
if (this.CheckSelfPermission(Manifest.Permission.Camera) != Permission.Granted)
{
Permissions.Add(Manifest.Permission.Camera);
}
if (this.CheckSelfPermission(Manifest.Permission.RecordAudio) != Permission.Granted)
{
Permissions.Add(Manifest.Permission.RecordAudio);
}
if (Permissions.Count > 0)
{
this.RequestPermissions(Permissions.ToArray(), PERMISSIONS_REQUEST);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment