The magnetometer measures the geomagnetic field strength around the device. It lets you monitor changes in the Earth’s magnetic field. This sensor provides raw field strength data (in μT) for each of the axis.

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_MAGNETOMETER: true or false to activate or deactivate accelerometer sensor.
  • Aware_Preferences.FREQUENCY_MAGNETOMETER: non-deterministic frequency in microseconds (dependent of the hardware sensor capabilities and resources). You can also use a SensorManager sensor delay constant.

aware-broadcasts

  • Magnetometer.ACTION_AWARE_MAGNETOMETER: new data recorded in provider.
    • Magnetometer.EXTRA_DATA: the recorded data, as ContentValues.
    • Magnetometer.EXTRA_SENSOR: the sensor information.
  • Magnetometer.ACTION_AWARE_MAGNETOMETER_LABEL: assign label to the recorded data.
    • Magnetometer.EXTRA_LABEL: the desired label.

aware-providers

Magnetometer Sensor

Contains the hardware sensor capabilities in the mobile device.

Magnetometer_Sensor.CONTENT_URI
content://com.aware.provider.magnetometer/sensor_magnetometer

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

Magnetometer Data

Contains the raw sensor data.

Magnetometer_Data.CONTENT_URI
content://com.aware.provider.magnetometer/magnetometer

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 geomagnetic field strength along the x axis, in μT
double_values_1 REAL the geomagnetic field strength along the y axis, in μT
double_values_2 REAL the geomagnetic field strength along the z axis, in μT
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

Magnetometer