private string GetPermissionString(PermissionName permissionName)
        {
            if (permissionName == PermissionName.FineLocationAlways)
            {
                return(UnityEngine.Android.Permission.FineLocation);
            }

            if (permissionName == PermissionName.LocationWhenInUse)
            {
                return(UnityEngine.Android.Permission.FineLocation);
            }
            throw new NotSupportedException("Permission name: " + permissionName.GetType().Name + " is not supported");
        }
 public void RequestUserPermission(PermissionName permissionName)
 {
     if (permissionName == PermissionName.FineLocationAlways)
     {
         LocationManagerBridge.requestAuthorizedAlways();
     }
     else if (permissionName == PermissionName.LocationWhenInUse)
     {
         LocationManagerBridge.requestAuthorizedWhenInUse();
     }
     else
     {
         throw new NotSupportedException("Permissions don't support this permission: " + permissionName.GetType().Name);
     }
 }
        public bool HasUserAuthorizedPermission(PermissionName permissionName)
        {
            GetAuthStatus();
            if (permissionName == PermissionName.FineLocationAlways &&
                locationAuthStatus == IOSPermissionAuthStatus.AuthorizedAlways)
            {
                return(true);
            }

            if (permissionName == PermissionName.LocationWhenInUse &&
                (locationAuthStatus == IOSPermissionAuthStatus.AuthorizedWhenInUse || locationAuthStatus == IOSPermissionAuthStatus.AuthorizedAlways))
            {
                return(true);
            }

            Debug.Log("location auth status: " + locationAuthStatus);

            return(false);
        }
 public bool HasUserAuthorizedPermission(PermissionName permissionName)
 {
     CheckPlatform();
     return(UnityEngine.Android.Permission.HasUserAuthorizedPermission(GetPermissionString(permissionName)));
 }
 public void RequestUserPermission(PermissionName permissionName)
 {
     CheckPlatform();
     UnityEngine.Android.Permission.RequestUserPermission(GetPermissionString(permissionName));
 }
 public void RequestUserPermission(PermissionName permissionName)
 {
 }
 public bool HasUserAuthorizedPermission(PermissionName permissionName)
 {
     return(true);
 }
 public string GetPermissionString(PermissionName permissionName)
 {
     return($"<editor-permission-string-{permissionName.GetType().Name}");
 }
Пример #9
0
 public static bool HasUserAuthorizedPermission(PermissionName permissionName)
 {
     return(platformPermission.HasUserAuthorizedPermission(permissionName));
 }
Пример #10
0
 internal static void RequestUserPermission(PermissionName permissionName)
 {
     platformPermission.RequestUserPermission(permissionName);
 }