The PhoneGap Compass API allows you to obtain the direction that the device is pointing to. The compass is a sensor that detects the direction or heading in which the device is pointed and returns the heading of the device in degrees using values from
359.99. The Compass API works similarly to the Accelerometer API; in fact you can read the current device heading or you can define a watcher in order to continuously read the heading value.
The Compass API is available on the
compass property of the
navigator object and exposes the following functions:
compass.getCurrentHeading, reads the current compass heading through a handler.
compass.watchHeading, reads the compass heading at a specific time interval through a handler and returns ...