HTML5 Device Motion Event

This event provides direct access to motion data from an accelerometer and gyroscope. The three pieces of data provided are the acceleration, acceleration including gravity and rotation rate.
At this moment the data supported is from Accelerometer only.


Code Example:
<script type="text/javascript">

window.addEventListener("devicemotion", function(event) {

		var ax = "Acceleration X value- " + event.accelerationIncludingGravity.x;
		var ay = "Acceleration Y value- " + event.accelerationIncludingGravity.y;
		var az = "Acceleration Z value- " + event.accelerationIncludingGravity.z;

		alert(ax+"\n"+ay+"\n"+az);

}, true);

</script>


Supported Platform(s)

- BlackBerry PlayBook 1.0+
- BlackBerry 10
- Ripple Emulator
View Supported Platform Table
APIBB5.0BB6.0BB7.0PB1.0PB2.0BB10Ripple
initDeviceMotionEvent       Y Y Y 
accelerationIncludingGravity       Y Y YY
interval       Y Y Y 

Configuration Document Settings

To use all of the API described for this object, you must ensure the following settings are in your configuration document:

This API does not require a <feature> element to be declared in the configuration document of your BlackBerry WebWorks Application.

Permission Elements (PlayBook and BlackBerry 10+)
This API does not require a <permission> element to be declared in the configuration document of your BlackBerry WebWorks Application.

Functions

void initDeviceMotionEvent ()


Initializes the event listener and it's parameters


Supported Platforms
 - BlackBerry PlayBook 1.0+
 - BlackBerry 10

Properties

readonly Acceleration accelerationIncludingGravity


Implementations that are unable to provide acceleration data without the effect of gravity (due, for example, to the lack of a gyroscope) may instead supply the acceleration including the effect of gravity. This is less useful in many applications but is provided as a means of providing best-effort support. In this case, the values reported are equal to the acceleration of the device, plus an acceleration equal and opposite to the acceleration due to gravity.


Supported Platforms
 - BlackBerry PlayBook 1.0+
 - BlackBerry 10
 - Ripple Emulator

readonly Number interval


The regular interval at which the event must fire at, given in milliseconds


Supported Platforms
 - BlackBerry PlayBook 1.0+
 - BlackBerry 10

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Feb 11 2013 14:51:05 GMT-0500 (EST)