The linear accelerometer measures the acceleration applied to the sensor built-in into the device, excluding the force of gravity, in m/s². For example, you could use this sensor to see how fast your car is going. The linear acceleration sensor always has an offset, which you need to remove. The simplest way to do this is to build a calibration step into your application. During calibration you can ask the user to set the device on a table, and then read the offsets for all three axes. You can then subtract that offset from the acceleration sensor’s direct readings to get the actual linear acceleration.

axis_device

The coordinate-system is defined relative to the screen of the phone in its default orientation (facing the user). The axis are not swapped when the device’s screen orientation changes. The X axis is horizontal and points to the right, the Y axis is vertical and points up and the Z axis points towards the outside of the front face of the screen. In this system, coordinates behind the screen have negative Z axis. Also, the natural orientation of a device is not always portrait, as the natural orientation for many tablet devices is landscape. For more information, check the official Android’s Sensor Coordinate System documentation.

Settings

  • Aware_Preferences.STATUS_LINEAR_ACCELEROMETER: true or false to activate or deactivate accelerometer sensor.
  • Aware_Preferences.FREQUENCY_LINEAR_ACCELEROMETER: non-deterministic frequency in microseconds (dependent of the hardware sensor capabilities and resources). You can also use a SensorManager sensor delay constant.

aware-broadcasts

  • LinearAccelerometer.ACTION_AWARE_LINEAR_ACCELEROMETER: new data recorded in provider.
    • LinearAccelerometer.EXTRA_DATA: the recorded data, as ContentValues.
    • LinearAccelerometer.EXTRA_SENSOR: the sensor information.
  • LinearAccelerometer.ACTION_AWARE_LINEAR_LABEL: assign label to the recorded data.
    • LinearAccelerometer.EXTRA_LABEL: the desired label.

aware-providers

Linear Accelerometer Sensor

Contains the hardware sensor capabilities in the mobile device.

Linear_Accelerometer_Sensor.CONTENT_URI
content://com.aware.provider.accelerometer.linear/sensor_linear_accelerometer

Table field Field type Description
_id INTEGER primary key, auto incremented
timestamp REAL unixtime milliseconds since 1970
device_id TEXT AWARE device UUID
double_sensor_maximum_range REAL Maximum sensor value possible
double_sensor_minimum_delay REAL Minimum sampling delay in microseconds
sensor_name TEXT Sensor’s name
double_sensor_power_ma REAL Sensor’s power drain in mA
double_sensor_resolution REAL Sensor’s resolution in sensor’s units
sensor_type TEXT Sensor’s type
sensor_vendor TEXT Sensor’s manufacturer
sensor_version TEXT Sensor’s version number

Linear Accelerometer Data

Contains the raw sensor data.

Linear_Accelerometer_Data.CONTENT_URI
content://com.aware.provider.accelerometer.linear/linear_accelerometer

Table field Field type Description
_id INTEGER primary key, auto incremented
timestamp REAL unixtime milliseconds since 1970
device_id TEXT AWARE device UUID
double_values_0 REAL the acceleration force along the x axis, excluding gravity, in m/s²
double_values_1 REAL the acceleration force along the y axis, excluding gravity, in m/s²
double_values_2 REAL the acceleration force along the z axis, excluding gravity, in m/s²
accuracy INTEGER Sensor’s accuracy level (see SensorManager)
label TEXT Customizable label. Useful for data calibration or traceability

 


icon_ios iOS

aware-broadcasts

aware-providers

Linear Accelerometer