Exemplo n.º 1
0
        public static void RequestPermissions(
            string[] permissions,
            Action <string> onGrantedCallback,
            Action <string> onDeniedCallback,
            Action <string> onDeniedAndDontAskAgainCallback)
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            AndroidPermissionsManager.RequestPermission(permissions,
                                                        new AndroidPermissionCallback(onGrantedCallback, onDeniedCallback, onDeniedAndDontAskAgainCallback));
#endif
        }
Exemplo n.º 2
0
        public static void RequestPermission(
            string permission,
            Action <string> onGrantedCallback,
            Action <string> onDeniedCallback,
            Action <string> onDeniedAndDontAskAgainCallback)
        {
#if UNITY_ANDROID && !UNITY_EDITOR
            if (!IsPermissionGranted(permission))
            {
                AndroidPermissionsManager.RequestPermission(new[] { permission },
                                                            new AndroidPermissionCallback(onGrantedCallback, onDeniedCallback, onDeniedAndDontAskAgainCallback));
            }
#endif
        }
 public void OnGrantButtonPress()
 {
     AndroidPermissionsManager.RequestPermission(new [] { STORAGE_PERMISSION }, new AndroidPermissionCallback(
                                                     grantedPermission =>
     {
         // The permission was successfully granted, restart the change avatar routine
         OnBrowseGalleryButtonPress();
     },
                                                     deniedPermission =>
     {
         // The permission was denied
     },
                                                     deniedPermissionAndDontAskAgain =>
     {
         // The permission was denied, and the user has selected "Don't ask again"
         // Show in-game pop-up message stating that the user can change permissions in Android Application Settings
         // if he changes his mind (also required by Google Featuring program)
     }));
 }