// Retrieve the SDK version number of the device.], from the API. public int GetSdkVersion() { if (Granter == null) { Granter = new PermissionGranterProxy(); } return(Granter.GetSdkVersion()); }
// Runtime permission granting is only accesible from devices with API 23 and up. // You should already be performing this check on your own. public bool IsCompatible() { if (Granter == null) { Granter = new PermissionGranterProxy(); } var versionNumber = Granter.GetSdkVersion(); return(versionNumber >= 23); }
// Request a permission of requestCode public void RequestPermission(int requestCode) { if (!IsCompatible()) { return; } if (Granter == null) { Granter = new PermissionGranterProxy(); } Granter.RequestPermission(requestCode); }
// Check a permission status of requestCode public bool CheckPermissions(int requestCode) { if (!IsCompatible()) { return(false); } if (Granter == null) { Granter = new PermissionGranterProxy(); } return(Granter.CheckForPermission(requestCode)); }