internal static void PlatformStart(SensorSpeed sensorSpeed) { var delay = SensorDelay.Normal; switch (sensorSpeed) { case SensorSpeed.Normal: delay = SensorDelay.Normal; break; case SensorSpeed.Fastest: delay = SensorDelay.Fastest; break; case SensorSpeed.Game: delay = SensorDelay.Game; break; case SensorSpeed.UI: delay = SensorDelay.Ui; break; } listener = new MagnetometerListener(); magnetometer = Platform.SensorManager.GetDefaultSensor(SensorType.MagneticField); Platform.SensorManager.RegisterListener(listener, magnetometer, delay); }
internal static void PlatformStart(SensorSpeed sensorSpeed) { var delay = sensorSpeed.ToPlatform(); listener = new MagnetometerListener(); magnetometer = Platform.SensorManager.GetDefaultSensor(SensorType.MagneticField); Platform.SensorManager.RegisterListener(listener, magnetometer, delay); }
internal static void PlatformStop() { if (listener == null || magnetometer == null) { return; } Platform.SensorManager.UnregisterListener(listener, magnetometer); listener.Dispose(); listener = null; }