Пример #1
0
        /**
         * @return <code>true</code> when the sensor was successfully enabled, <code>false</code> otherwise.
         */
        public bool EnableAccelerometerSensor(/* final */ Context pContext, /* final */ IAccelerometerListener pAccelerometerListener, /* final */ AccelerometerSensorOptions pAccelerometerSensorOptions)
        {
            /* final */
            SensorManager sensorManager = (SensorManager)pContext.GetSystemService(Context.SensorService);

            //if (this.isSensorSupported(sensorManager, SensorType.Accelerometer))
            if (this.IsSensorSupported(sensorManager, SensorType.Accelerometer))
            {
                this.mAccelerometerListener = pAccelerometerListener;

                if (this.mAccelerometerData == null)
                {
                    this.mAccelerometerData = new AccelerometerData();
                }

                this.RegisterSelfAsSensorListener(sensorManager, SensorType.Accelerometer, pAccelerometerSensorOptions.getSensorDelay());

                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
 /**
  * @see {@link Engine#enableAccelerometerSensor(Context, IAccelerometerListener, AccelerometerSensorOptions)}
  */
 protected bool EnableAccelerometerSensor(IAccelerometerListener pAccelerometerListener, AccelerometerSensorOptions pAccelerometerSensorOptions)
 {
     return(this.mEngine.EnableAccelerometerSensor(this, pAccelerometerListener, pAccelerometerSensorOptions));
 }