示例#1
0
        //Check for permission (using local value)
        public void CheckPermission()
        {
            if (string.IsNullOrEmpty(permission))
            {
                return;
            }

#if UNITY_EDITOR
            Debug.Log("PermissionCheckController.CheckPermission called.");
#elif UNITY_ANDROID
            bool granted = oldGranted = AndroidPlugin.CheckPermission(permission);

            if (!granted && requestWhenNotGranted)
            {
                AndroidPlugin.CheckPermissionAndRequest(permission, title, message, gameObject.name, "ReceiveResultPermission", style);
            }
            else
            {
                if (OnResult != null)
                {
                    OnResult.Invoke(permission, granted);
                }

                if (granted)
                {
                    if (OnGranted != null)
                    {
                        OnGranted.Invoke();
                    }
                }
                else
                {
                    if (OnDenied != null)
                    {
                        OnDenied.Invoke();
                    }
                }
            }
#endif
        }