コード例 #1
0
        private void _Connect()
        {
            ARDebug.LogInfo("_connect begin");
            const string ANDROID_CAMERA_PERMISSION_NAME = "android.permission.CAMERA";

            if (AndroidPermissionsRequest.IsPermissionGranted(ANDROID_CAMERA_PERMISSION_NAME))
            {
                _ConnectToService();
                return;
            }
            var permissionsArray = new string[] { ANDROID_CAMERA_PERMISSION_NAME };

            AndroidPermissionsRequest.RequestPermission(permissionsArray).ThenAction((requestResult) =>
            {
                if (requestResult.IsAllGranted)
                {
                    _ConnectToService();
                }
                else
                {
                    ARDebug.LogError("connection failed because a needed permission was rejected.");
                    errorMessage = "This app require camera permission";
                    Log();
                    Invoke("_DoQuit", 0.5f);
                    return;
                }
            });
        }
コード例 #2
0
 public void Resume()
 {
     if (ARSessionStatus.STOPPED == SessionStatus)
     {
         ARDebug.LogWarning("Session is stopped when resume, ignore it");
         return;
     }
     if (!AndroidPermissionsRequest.IsPermissionGranted("android.permission.CAMERA"))
     {
         throw new ARCameraPermissionDeniedException();
     }
     m_ndkSession.SessionAdapter.Resume();
     SessionStatus = ARSessionStatus.RESUMED;
 }