/** * Returns true if the Activity has access to a given permission. * Always returns true on platforms below M. * * @see Activity#checkSelfPermission(String) */ public static bool HasSelfPermission (Activity activity, string permission) { // Below Android M all permissions are granted at install time and are already available. if (!IsMNC) return true; return activity.CheckSelfPermission (permission) == (int)Permission.Granted; }
/** * Returns true if the Activity has access to all given permissions. * Always returns true on platforms below M. * * See Activity#checkSelfPermission (String) */ public static bool HasSelfPermission (Activity activity, string[] permissions) { // Below Android M all permissions are granted at install time and are already available. if (!IsMNC) return true; // Verify that all required permissions have been granted foreach (string permission in permissions) if (activity.CheckSelfPermission (permission) != (int)Permission.Granted) return false; return true; }
public static bool NeedPermissions(Activity activity) { return activity.CheckSelfPermission(Manifest.Permission.Camera) != Permission.Granted || activity.CheckSelfPermission(Manifest.Permission.WriteExternalStorage) != Permission.Granted; }