Posted By

parkerkrhoyt on 11/11/11


Tagged

phone mobile Sensor device Compass phonegap gap


Versions (?)

Using the Device Compass with PhoneGap


 / Published in: JavaScript
 

  1. var watchId = 0;
  2.  
  3. watchId = navigator.compass.watchHeading( function( heading ) {
  4. $( '#compass' ).css( '-webkit-transform', 'rotate( ' + heading.magneticHeading + 'deg )' );
  5. }, function( error ) {
  6. console.log( 'Error' );
  7. }, {
  8. frequency: 100
  9. } );

Report this snippet  

You need to login to post a comment.