The gravity sensor measures the force of gravity applied to the sensor built-in into the device and provides a three dimensional vector indicating the direction and magnitude of gravity (in m/s²). When a device is at rest, the gravity sensor should measure equally as the accelerometer.
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_GRAVITY: true or false to activate or deactivate accelerometer sensor.
- Aware_Preferences.FREQUENCY_GRAVITY: non-deterministic frequency in microseconds (dependent of the hardware sensor capabilities and resources). You can also use a SensorManager sensor delay constant.
- Gravity.ACTION_AWARE_GRAVITY: new data recorded in provider.
- Gravity.EXTRA_DATA: the recorded data, as ContentValues.
- Gravity.EXTRA_SENSOR: the sensor information.
- Gravity.ACTION_AWARE_GRAVITY_LABEL: assign label to the recorded data.
- Gravity.EXTRA_LABEL: the desired label.
Gravity Sensor
Contains the hardware sensor capabilities in the mobile device.
Gravity_Sensor.CONTENT_URI
content://com.aware.provider.gravity/sensor_gravity
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 |
Gravity Data
Contains the raw sensor data.
Gravity_Data.CONTENT_URI
content://com.aware.provider.gravity/gravity
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 |