Skip to content

Instantly share code, notes, and snippets.

@rdelrosario
Created October 10, 2019 21:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rdelrosario/ece29025a9f22a9562b1d39771c6844a to your computer and use it in GitHub Desktop.
Save rdelrosario/ece29025a9f22a9562b1d39771c6844a to your computer and use it in GitHub Desktop.
using System;
using Android.Content.PM;
namespace ContactListSample.Droid
{
public static class PermissionUtil
{
/**
* Check that all given permissions have been granted by verifying that each entry in the
* given array is of the value Permission.Granted.
*
* See Activity#onRequestPermissionsResult (int, String[], int[])
*/
public static bool VerifyPermissions(Permission[] grantResults)
{
// At least one result must be checked.
if (grantResults.Length < 1)
return false;
// Verify that each required permission has been granted, otherwise return false.
foreach (Permission result in grantResults)
{
if (result != Permission.Granted)
{
return false;
}
}
return true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment