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 AccelerometerListener();
            accelerometer = Platform.SensorManager.GetDefaultSensor(SensorType.Accelerometer);
            Platform.SensorManager.RegisterListener(listener, accelerometer, delay);
        }
Beispiel #2
0
        internal static void PlatformStart(SensorSpeed sensorSpeed)
        {
            var delay = sensorSpeed.ToPlatform();

            listener      = new AccelerometerListener();
            accelerometer = Platform.SensorManager.GetDefaultSensor(SensorType.Accelerometer);
            Platform.SensorManager.RegisterListener(listener, accelerometer, delay);
        }
        internal static void PlatformStop()
        {
            if (listener == null || accelerometer == null)
            {
                return;
            }

            Platform.SensorManager.UnregisterListener(listener, accelerometer);
            listener.Dispose();
            listener = null;
        }