Android.Hardware.SensorEvent Members

The members of Android.Hardware.SensorEvent are listed below.

See Also: Inherited members from Java.Lang.Object

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

AccuracySensorStatus. The accuracy of this event.
SensorSensor. The sensor that generated this event.
Timestamplong. The time in nanosecond at which the event happened
ValuesIList<float>.

Sensor.TYPE_ACCELEROMETER:

All values are in SI units (m/s^2)
  • values[0]: Acceleration minus Gx on the x-axis
  • values[1]: Acceleration minus Gy on the y-axis
  • values[2]: Acceleration minus Gz on the z-axis
Ad = - &#8721;Fs / mass
Ad = -g - &#8721;F / mass

java Example


     public void onSensorChanged(SensorEvent event)
     {
          // alpha is calculated as t / (t + dT)
          // with t, the low-pass filter's time-constant
          // and dT, the event delivery rate

          final float alpha = 0.8;

          gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0];
          gravity[1] = alpha * gravity[1] + (1 - alpha) * event.values[1];
          gravity[2] = alpha * gravity[2] + (1 - alpha) * event.values[2];

          linear_acceleration[0] = event.values[0] - gravity[0];
          linear_acceleration[1] = event.values[1] - gravity[1];
          linear_acceleration[2] = event.values[2] - gravity[2];
     }
 
The three elements of the rotation vector are equal to the last three components of a unit quaternion <cos(&#952/2), x*sin(&#952/2), y*sin(&#952/2), z*sin(&#952/2)>.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.