/// <summary> /// When destroyed, stop all sensors and disconnect from the Wearable device. /// </summary> protected override void OnDestroy() { for (var i = 0; i < WearableConstants.SensorIds.Length; i++) { _activeProvider.StopSensor(WearableConstants.SensorIds[i]); } for (var i = 0; i < WearableConstants.GestureIds.Length; i++) { if (WearableConstants.GestureIds[i] == GestureId.None) { continue; } _activeProvider.DisableGesture(WearableConstants.GestureIds[i]); } DisconnectFromDevice(); // Clean up providers _activeProvider.OnDisableProvider(); if (_deviceProvider != null && _deviceProvider.Initialized) { _deviceProvider.OnDestroyProvider(); } if (_debugProvider != null && _debugProvider.Initialized) { _debugProvider.OnDestroyProvider(); } base.OnDestroy(); }
/// <summary> /// When destroyed, stop all sensors and disconnect from the Wearable device. /// </summary> protected override void OnDestroy() { _accelerometerSensor.Stop(); _gyroscopeSensor.Stop(); _rotationSensor.Stop(); _gameRotationSensor.Stop(); DisconnectFromDevice(); // Clean up providers _activeProvider.OnDisableProvider(); if (_deviceProvider != null && _deviceProvider.Initialized) { _deviceProvider.OnDestroyProvider(); } if (_debugProvider != null && _debugProvider.Initialized) { _debugProvider.OnDestroyProvider(); } base.OnDestroy(); }