public static void RequestPremission(AndroidPermission permission, Action onPermit = null, Action notPermit = null) { Debug.Log(log + "RequestPremission : " + gameObjectName); permissionManager.CallStatic("requestPermission", GetPermittionStr(permission), gameObjectName); permitCallBack = onPermit; notPermitCallBack = notPermit; }
public static void GrantPermission(AndroidPermission permission, Action <bool> requestCallback = null, bool enableLogging = false) { #if !UNITY_ANDROID if (enableLogging) { Debug.LogWarning("Only Android platform is supported"); } return; #endif #if UNITY_EDITOR if (enableLogging) { Debug.LogWarning("Editor is not supported, test on an actual device or an Android Emulator"); } return; #endif if (!initialized) { initialize(); } PermissionRequestCallback = requestCallback; PermissionPleaseClass.CallStatic("grantPermission", activity, (int)permission, enableLogging); }
private void GrantPermission(AndroidPermission permission) { if (!initialized) { initializePermissionGranter(); } permissionGranterClass.CallStatic("grantPermission", activity, (int)permission); }
public static void CheckPermissionAndReDirectToSettingsScreen(AndroidPermission permission, Action <string> OnDeniedPermissionByUser = null) { Debug.Log(log + "CheckPermissionAndReDirectToSettingsScreen : " + gameObjectName); if (!HasPermission(permission)) { permissionManager.CallStatic("ShowDialogAndReDirectToSettings", GetPermittionStr(permission), gameObjectName); deniedByUserCallBack = OnDeniedPermissionByUser; } }
public static bool IsPermitted(AndroidPermission permission) { #if UNITY_ANDROID && !UNITY_EDITOR using (var androidUtils = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { return(androidUtils.GetStatic <AndroidJavaObject>("currentActivity").Call <bool>("hasPermission", GetPermissionStrr(permission))); } #endif return(true); }
public static bool IsPermitted(AndroidPermission permission) { #if UNITY_EDITOR Debug.LogWarning("UniAndroidPermission works only Androud Devices."); return(true); #elif UNITY_ANDROID AndroidJavaClass permissionManager = new AndroidJavaClass(PackageClassName); return(permissionManager.CallStatic <bool> ("hasPermission", GetPermittionStr(permission))); #endif return(true); }
public static bool IsPermitted(AndroidPermission permission) { #if !UNITY_EDITOR && UNITY_ANDROID using (var permissionManager = new AndroidJavaClass(PackageName)) { return(permissionManager.CallStatic <bool>("hasPermission", GetPermittionStr(permission))); } #else return(true); #endif }
public static bool IsPermitted(AndroidPermission permission) { #if UNITY_ANDROID using (var permissionManager = new AndroidJavaObject("com.inode.dreamcity.SaveImageActivity")) { return(permissionManager.CallStatic <bool>("hasPermission", GetPermissionStr(permission))); } #else return(true); #endif }
public static void RequestPermission(AndroidPermission permission, Action onAllow = null, Action onDeny = null, Action onDenyAndNeverAskAgain = null) { #if UNITY_ANDROID using (var permissionManager = new AndroidJavaObject("com.inode.dreamcity.SaveImageActivity")) { permissionManager.CallStatic("requestPermission", GetPermissionStr(permission)); } #else Debug.LogWarning("UniAndroidPermission works only on Android Devices."); #endif }
public static bool IsPermitted(AndroidPermission permission) { #if UNITY_EDITOR Debug.LogWarning("UniAndroidPermission works only Androud Devices."); return true; #elif UNITY_ANDROID AndroidJavaClass permissionManager = new AndroidJavaClass (PackageClassName); return permissionManager.CallStatic<bool> ("hasPermission", GetPermittionStr(permission)); #endif return true; }
public static void RequestPremission(AndroidPermission permission, Action onPermit = null, Action notPermit = null) { #if UNITY_EDITOR Debug.LogWarning("UniAndroidPermission works only Androud Devices."); return; #elif UNITY_ANDROID AndroidJavaClass permissionManager = new AndroidJavaClass(PackageClassName); permissionManager.CallStatic("requestPermission", GetPermittionStr(permission)); permitCallBack = onPermit; notPermitCallBack = notPermit; #endif }
public static void RequestPermission(AndroidPermission permission, UnityAction onAllow = null, UnityAction onDeny = null, UnityAction onDenyAndNeverAskAgain = null) { #if UNITY_ANDROID && !UNITY_EDITOR onAllowCallback = onAllow; onDenyCallback = onDeny; onDenyAndNeverAskAgainCallback = onDenyAndNeverAskAgain; using (var androidUtils = new AndroidJavaClass("com.unity3d.player.UnityPlayer")) { androidUtils.GetStatic <AndroidJavaObject>("currentActivity").Call("requestPermission", GetPermissionStrr(permission)); } #endif }
public static void RequestPremission(AndroidPermission permission, Action onPermit = null, Action notPermit = null) { #if UNITY_EDITOR Debug.LogWarning("UniAndroidPermission works only Androud Devices."); return; #elif UNITY_ANDROID AndroidJavaClass permissionManager = new AndroidJavaClass (PackageClassName); permissionManager.CallStatic("requestPermission", GetPermittionStr(permission)); permitCallBack = onPermit; notPermitCallBack = notPermit; #endif }
/// <summary> /// 許可画面で、「二度と表示しない」をユーザーが押したかどうかを調べる。 /// </summary> /// <returns><c>true</c>, if show request permission rationale was shoulded, <c>false</c> otherwise.</returns> /// <param name="permission">Permission.</param> public static bool ShouldShowRequestPermissionRationale(AndroidPermission permission) { bool answer = false; #if UNITY_ANDROID using (AndroidJavaClass plugin = new AndroidJavaClass(ANDROID_PERMISSION_CLASS_NAME)) { answer = plugin.CallStatic <bool>("shouldShowRequestPermissionRationale", permission.permissionValue); } #endif return(answer); }
public bool IsNeverAsk(AndroidPermission permission) { #if UNITY_EDITOR return(false); #elif UNITY_ANDROID AndroidJavaClass permissionManager = new AndroidJavaClass(PackageClassName); return(permissionManager.CallStatic <bool>("isPermissionNeverAsk", GetPermissionStr(new List <AndroidPermission>() { permission }))); #endif }
public static bool IsPermitted(AndroidPermission permission) { #if UNITY_EDITOR Debug.LogWarning("UniAndroidPermission works only Androud Devices."); return(true); #elif UNITY_ANDROID AndroidJavaClass unityPlayer = new AndroidJavaClass("com.tiam.gcmplugin.MainActivity"); AndroidJavaObject appContext = unityPlayer.GetStatic <AndroidJavaObject>("currentContext"); AndroidJavaClass permissionManager = new AndroidJavaClass(PackageClassName); return(permissionManager.CallStatic <bool> ("hasPermission", appContext, GetPermittionStr(permission))); #endif return(true); }
public static void RequestPermission(AndroidPermission permission, Action onAllow = null, Action onDeny = null, Action onDenyAndNeverAskAgain = null) { #if !UNITY_EDITOR && UNITY_ANDROID using (var permissionManager = new AndroidJavaClass(PackageName)) { permissionManager.CallStatic("requestPermission", GetPermittionStr(permission)); onAllowCallback = onAllow; onDenyCallback = onDeny; onDenyAndNeverAskAgainCallback = onDenyAndNeverAskAgain; } #else Debug.LogWarning("UniAndroidPermission works only Androud Devices."); #endif }
public static void RequestCameraPremission(AndroidPermission permission, Action onPermit = null, Action notPermit = null) { #if UNITY_EDITOR Debug.LogWarning("UniAndroidPermission works only Androud Devices."); return; #elif UNITY_ANDROID AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); //AndroidJavaObject appContext = unityPlayer.GetStatic<AndroidJavaObject>("currentContext"); AndroidJavaObject activity = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity"); AndroidJavaClass permissionManager = new AndroidJavaClass(PackageClassName); permissionManager.CallStatic("requestCameraPermission", activity); permitCallBack = onPermit; notPermitCallBack = notPermit; #endif }
/// <summary> /// 権限があるかチェックする。ある場合はtrue /// </summary> /// <returns><c>true</c>, if android permission was checked, <c>false</c> otherwise.</returns> /// <param name="permission">Permission string.</param> public static bool CheckSelfPermission(AndroidPermission permission) { bool answer = true; #if UNITY_ANDROID using (AndroidJavaClass plugin = new AndroidJavaClass(ANDROID_PERMISSION_CLASS_NAME)) { var valueFromAndroidMethod = plugin.CallStatic <int>("checkSelfPermission", permission.permissionValue); if (valueFromAndroidMethod != 0) { answer = false; } } #endif return(answer); }
public PermissionEditor(string permission, Gtk.Window parent) { parentWindow = parent; this.TransientFor = parentWindow; this.Build(); Pango.FontDescription customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont); tvPermission.ModifyFont(customFont); AndroidPermission ap = new AndroidPermission(); foreach (string str in ap.Sections()) { //Console.WriteLine(str); Button btn = new Button(); btn.Name = str; btn.Label = str; btn.HeightRequest = 25; btn.Clicked += delegate(object sender, EventArgs e) { string[] values = ap.ValuesInSection(btn.Name); string tmp = String.Join("\n", values); if (!String.IsNullOrEmpty(tvPermission.Buffer.Text)) { tvPermission.Buffer.Text = tvPermission.Buffer.Text + "\n"; } tvPermission.Buffer.Text = tvPermission.Buffer.Text + tmp; }; vbButton.PackEnd(btn, true, true, 0); } vbButton.ShowAll(); if (!string.IsNullOrEmpty(permission)) { tvPermission.Buffer.Text = permission; } else { // insert default } }
public static bool HasPermission(AndroidPermission permission) { Debug.Log(log + "Awake : " + gameObjectName); return(permissionManager.CallStatic <bool>("hasPermission", GetPermittionStr(permission))); }
private static string GetPermissionStr(AndroidPermission permission) { return("android.permission." + permission.ToString()); }
public static bool ShouldShowRequestPermission(AndroidPermission feature) { return(GetPermissionsService().Call <bool>("ShouldShowRequestPermission", GetActivity(), GetPermissionString(feature))); }
private static string GetPermittionStr(AndroidPermission permittion) { return "android.permission." + permittion.ToString (); }
public static void RequestPermission(AndroidPermission feature, AndroidPermissionCallback callback) { RequestPermissions(new[] { feature }, callback); }
public static bool WasDeniedOnce(AndroidPermission permission) { Debug.Log(log + "WasDeniedOnce : " + gameObjectName); permissionManager = new AndroidJavaClass(PackageClassName); return(permissionManager.CallStatic <bool>("wasDeniedOnce", GetPermittionStr(permission))); }
public static bool IsPermissionGranted(AndroidPermission feature) { return(GetPermissionsService().Call <bool>("IsPermissionGranted", GetActivity(), GetPermissionString(feature))); }