protected override void OnResume() { base.OnResume(); // ArFragment of Sceneform automatically requests the camera permission before creating the AR session, // so we don't need to request the camera permission explicitly. // This will cause onResume to be called again after the user responds to the permission request. if (!SceneformHelper.HasCameraPermission(this)) { return; } if (this.sceneView?.Session is null && !SceneformHelper.TrySetupSessionForSceneView(this, this.sceneView)) { // Exception will be logged and SceneForm will handle any ARCore specific issues. this.Finish(); return; } if (string.IsNullOrWhiteSpace(AccountDetails.SpatialAnchorsAccountId) || AccountDetails.SpatialAnchorsAccountId == "Set me" || string.IsNullOrWhiteSpace(AccountDetails.SpatialAnchorsAccountKey) || AccountDetails.SpatialAnchorsAccountKey == "Set me") { Toast.MakeText(this, $"\"Set {AccountDetails.SpatialAnchorsAccountId} and {AccountDetails.SpatialAnchorsAccountKey} in {nameof(AccountDetails)}.cs\"", ToastLength.Long) .Show(); this.Finish(); return; } if (this.currentDemoStep == DemoStep.Start) { this.StartDemo(); } }
protected override void OnResume() { base.OnResume(); // ArFragment of Sceneform automatically requests the camera permission before creating the AR session, // so we don't need to request the camera permission explicitly. // This will cause onResume to be called again after the user responds to the permission request. if (!SceneformHelper.HasCameraPermission(this)) { return; } if (sceneView?.Session is null && !SceneformHelper.TrySetupSessionForSceneView(this, sceneView)) { // Exception will be logged and SceneForm will handle any ARCore specific issues. Finish(); return; } if (string.IsNullOrWhiteSpace(AccountDetails.SpatialAnchorsAccountId) || AccountDetails.SpatialAnchorsAccountId == "Set me" || string.IsNullOrWhiteSpace(AccountDetails.SpatialAnchorsAccountKey) || AccountDetails.SpatialAnchorsAccountKey == "Set me" || string.IsNullOrWhiteSpace(AccountDetails.SpatialAnchorsAccountDomain) || AccountDetails.SpatialAnchorsAccountDomain == "Set me") { Toast.MakeText(this, $"\"Set {AccountDetails.SpatialAnchorsAccountId}, {AccountDetails.SpatialAnchorsAccountKey}, and {AccountDetails.SpatialAnchorsAccountDomain} in {nameof(AccountDetails)}.cs\"", ToastLength.Long) .Show(); Finish(); return; } SensorPermissionsHelper.RequestMissingPermissions(this); cloudAnchorManager = new AzureSpatialAnchorsManager(sceneView.Session); cloudAnchorManager.StartSession(); locationProvider = new PlatformLocationProvider(); locationProvider.Sensors.SetKnownBeaconProximityUuids(CoarseRelocSettings.KnownBluetoothProximityUuids); SensorPermissionsHelper.EnableAllowedSensors(this, locationProvider); cloudAnchorManager.LocationProvider = locationProvider; sensorStatusView.Model = new LocationProviderSensorStatus(locationProvider); }