public void OnApplicationPause(bool isPaused)
 {
     if (isPaused)
     {
         ARSession.Pause();
     }
     else
     {
         if (!isSessionCreated)
         {
             Init();
         }
         if (isErrorHappendWhenInit)
         {
             return;
         }
         try
         {
             ARSession.Resume();
         }
         catch (ARCameraPermissionDeniedException e)
         {
             ARDebug.LogError("camera permission is denied");
             errorMessage = "This app require camera permission";
             Log();
             Invoke("_DoQuit", 0.5f);
         }
     }
 }
Ejemplo n.º 2
0
 protected override void OnPause()
 {
     Log.Debug(TAG, "onPause start.");
     base.OnPause();
     if (mArSession != null)
     {
         mDisplayRotationManager.UnregisterDisplayListener();
         mSurfaceView.OnPause();
         mArSession.Pause();
     }
     Log.Debug(TAG, "onPause end.");
 }
Ejemplo n.º 3
0
        public override void WasInterrupted(ARSession session)
        {
            // pause session
            session.Pause();

            // specify that existing tracking should be discarded
            var opts = ARSessionRunOptions.RemoveExistingAnchors
                       | ARSessionRunOptions.ResetTracking;

            // restart session
            session.Run(session.Configuration, opts);
        }
Ejemplo n.º 4
0
 private void EndSession()
 {
     if (currentSession != null)
     {
         currentSession.Pause();
         currentSession = null;
     }
     if (currentSessionDelegate != null)
     {
         currentSessionDelegate = null;
     }
 }
 public override void DidFail(ARSession session, NSError error)
 {
     if (error.Code == 102)
     {
         session.Pause();
         session.Run(new ARWorldTrackingConfiguration
         {
             AutoFocusEnabled       = true,
             PlaneDetection         = ARPlaneDetection.Horizontal,
             LightEstimationEnabled = true,
             WorldAlignment         = ARWorldAlignment.Gravity
         }, ARSessionRunOptions.ResetTracking | ARSessionRunOptions.RemoveExistingAnchors);
     }
 }
Ejemplo n.º 6
0
        private bool IsAREngineSupported()
        {
#if HAS_HUAWEI_ARENGINE
            try
            {
                AREnginesAvaliblity ability = AREnginesSelector.Instance.CheckDeviceExecuteAbility();
                if ((AREnginesAvaliblity.HUAWEI_AR_ENGINE & ability) != 0)
                {
                    AREnginesSelector.Instance.SetAREngine(AREnginesType.HUAWEI_AR_ENGINE);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                return(false);
            }

            GameObject go = null;
            try
            {
                go = Instantiate(AREnginePrefab);
                ARSession.CreateSession();
                ARSession.Config(go.GetComponent <SessionComponent>().Config);
                ARSession.Resume();
                ARSession.SetCameraTextureNameAuto();
                ARSession.SetDisplayGeometry(Screen.width, Screen.height);
                ARSession.Pause();
                ARSession.Stop();
                Destroy(go);
                return(true);
            }
            catch (Exception e)
            {
            }
            if (go != null)
            {
                Destroy(go);
            }
#endif
            return(false);
        }
Ejemplo n.º 7
0
        protected override void OnPause()
        {
            Log.Debug(TAG, "OnPause Start.");
            base.OnPause();
            if (isOpenCameraOutside)
            {
                if (mCamera != null)
                {
                    mCamera.CloseCamera();
                    mCamera.StopCameraThread();
                    mCamera = null;
                }
            }

            if (mArSession != null)
            {
                mDisplayRotationManager.UnregisterDisplayListener();
                glSurfaceView.OnPause();
                mArSession.Pause();
                Log.Debug(TAG, "Session paused!");
            }
            Log.Debug(TAG, "OnPause end.");
        }
Ejemplo n.º 8
0
 protected override void OnDeleted()
 {
     base.OnDeleted();
     ARSession.Pause();
 }