Created
November 13, 2019 19:26
-
-
Save rdelrosario/be47d6872c12b4120703382db9c63cf5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Android.Content.PM; | |
namespace CustomMediaGallery.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