icon_android Android

The accelerometer measures the acceleration applied to the sensor built-in into the device, including the force of gravity. In other words, the force of gravity is always influencing the measured acceleration, thus when the device is sitting on a table, the accelerometer reads the acceleration of gravity: 9.81 m/s². Similarly, if the phone is in free-fall towards the ground, the accelerometer reads: 0 m/s².

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.

Public functions

  • Accelerometer.getFrequency( Context context ): returns sampling rate in Hz.

Settings

  • Aware_Preferences.STATUS_ACCELEROMETER: true or false to activate or deactivate accelerometer sensor.
  • Aware_Preferences.FREQUENCY_ACCELEROMETER: non-deterministic frequency in microseconds (dependent of the hardware sensor capabilities and resources), e.g., 200000 (normal), 60000 (UI), 20000 (game), 0 (fastest).

aware-broadcasts

  • Accelerometer.ACTION_AWARE_ACCELEROMETER: new data recorded in provider.
    • Accelerometer.EXTRA_DATA: the recorded data, as ContentValues.
  • Accelerometer.ACTION_AWARE_ACCELEROMETER_LABEL: send this broadcast to assign a label to the ongoing recording of data.
    • Accelerometer.EXTRA_LABEL: the desired label.

aware-providers

Accelerometer Sensor

Contains the hardware sensor capabilities in the mobile device.

Accelerometer_Sensor.CONTENT_URI
content://com.aware.provider.accelerometer/sensor_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

Accelerometer Data

Contains the raw sensor data.

Accelerometer_Data.CONTENT_URI
content://com.aware.provider.accelerometer/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 value of X axis
double_values_1 REAL value of Y axis
double_values_2 REAL value of Z axis
accuracy INTEGER Sensor’s accuracy level (see SensorManager)
label TEXT Customizable label. Useful for data calibration or traceability


icon_ios iOS

The accelerometer measures velocity over time along three axes, as shown in Figure. A G is a unit of gravitation force equal to that exerted by the earth’s gravitational field (9.81 m s−2).

acceleration_axes_2x

For more detail information, check the official iOS’s Motion Event documentation.

aware-broadcasts

  • ACTION_AWARE_ACCELEROMETER: new data recorded in provider.
    • EXTRA_DATA: the recorded data, as ContentValues.

aware-providers

Accelerometer Data

Contains the raw sensor data.

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 value of X axis
double_values_1 REAL value of Y axis
double_values_2 REAL value of Z axis
accuracy INTEGER This column is not supported on iOS
label TEXT Customizable label. Useful for data calibration or traceability
Accelerometer