/// <summary> /// Overrise to setup the session configuration /// </summary> protected override Config GetSessionConfiguration(Session session) { var config = new Config(session); config.SetUpdateMode(Config.UpdateMode.LatestCameraImage); config.SetFocusMode(Config.FocusMode.Auto); ArSceneView.SetupSession(session); return(config); }
private void SetupSessionForSceneView(Context context, ArSceneView sceneView) { try { Session session = new Session(context); Config config = new Config(session); config.SetUpdateMode(Config.UpdateMode.LatestCameraImage); session.Configure(config); sceneView.SetupSession(session); } catch (Exception ex) { Android.Util.Log.Error("ASADemo: ", ex.ToString()); } }
protected override void OnResume() { base.OnResume(); if (locationScene != null) { locationScene.Resume(); } if (arSceneView.Session == null) { // If the session wasn't created yet, don't resume rendering. // This can happen if ARCore needs to be updated or permissions are not granted yet. try { Session session = CreateArSession(this, installRequested); if (session == null) { installRequested = ARLocationPermissionHelper.HasPermission(this); return; } else { arSceneView.SetupSession(session); } } catch (UnavailableException e) { string message; if (e is UnavailableArcoreNotInstalledException) { message = "Please install ARCore"; } else if (e is UnavailableApkTooOldException) { message = "Please update ARCore"; } else if (e is UnavailableSdkTooOldException) { message = "Please update this app"; } else if (e is UnavailableDeviceNotCompatibleException) { message = "This device does not support AR"; } else { message = "Failed to create AR session"; } Toast.MakeText(this, message, ToastLength.Long).Show(); } } try { arSceneView.Resume(); } catch (System.Exception ex) { Finish(); return; } if (arSceneView.Session != null) { ShowLoadingMessage(); } }