Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Properties

Functions

This function will set a sensor with the specifed options. Sensor options can be set before or after the sensor is active.

The supported object fields for 'options' are:

Supported Platforms

- BlackBerry 10

Parameters

sensor

The sensor to listen to.

options

The options for the sensor being started.

delay: Time in µs (microseconds) to report back between sensor updates.
background: Allow sensor to send updates while the screen is off.
batching: When batching is enabled and supported by the hardware, sensors will report samples in hardware-specific batch sizes to conserve power.
queue: Enabling the queue creates a client-specific service side queue of events, this is useful to not miss any events.
reducedReporting: When reduced reporting is enabled, only a significant change between the last read event and the current unread event will cause an event to be delivered (useful for power saving).

Events

static
void
blackberry.sensors.deviceaccelerometer
(data : Object)

Device accelerometer sensor.

This sensor returns accelerometer data. Returned as m/s/s (meters/second/second).

Supported Platforms

- BlackBerry 10

Parameters

data

The object containing the sensor data.

x: The x-axis value.
y: The y-axis value.
z: The z-axis value.

static
void
blackberry.sensors.deviceazimuthpitchroll
(data : Object)

Device sensor azimuth pitch roll sensor.

This sensor returns a rotation matrix based on the orientation of the device.

static
void
blackberry.sensors.devicecompass
(data : Object)

value: Azimuth from 0 -> 360 degrees from magnetic north.
isFaceDown: 1 if face is down and compass heading is flipped, 0 otherwise.

static
void
blackberry.sensors.devicegravity
(data : Object)

Device gravity sensor.

This sensor returns gravity information from the gravity sensor. Returned as m/s/s (meters/second/second).
Only the acceleration caused by gravity is reported. Movements of the device caused by the user have no effect other than changing the direction when the device is rotated.

Supported Platforms

- BlackBerry 10

Parameters

data

The object containing the sensor data.

x: The x-axis value.
y: The y-axis value.
z: The z-axis value.

static
void
blackberry.sensors.devicegyroscope
(data : Object)

Device gyroscope sensor.

This sensor returns data from the gyroscope sensor. Returned as r/s (radians/second).

This sensor returns linear acceleration data from the device accelerometer. Returned as m/s/s (meters/second/second).
Only the acceleration caused by the user moving the device is reported, the effect of gravity is canceled out.

Supported Platforms

- BlackBerry 10

Parameters

data

The object containing the sensor data.

x: The x-axis value.
y: The y-axis value.
z: The z-axis value.

static
void
blackberry.sensors.devicemagnetometer
(data : Object)

Device magnetometer sensor.

This sensor returns values from the device's magnetometer. Returned as µT (micro Tesla).

Supported Platforms

- BlackBerry 10

Parameters

data

The object containing the sensor data.

x: The x-axis value.
y: The y-axis value.
z: The z-axis value.

static
void
blackberry.sensors.deviceorientation
(data : Object)

Device orientation sensor.

This sensor returns device orientation information.
This relates to the physical device orientation.