Return to Snippet

Revision: 52886
at November 4, 2011 02:42 by parkerkrhoyt


Initial Code
var latest = null;

function doDeviceReady()
{
  var options = {
    frequency: FREQUENCY_ACCEL
  };	
			
  watchID = navigator.accelerometer.watchAcceleration( 
    doAcceleration,
    doError, 
    options 
  );		
}

function doAcceleration( acceleration )
{
  latest = {
    x: acceleration.x,
    y: acceleration.y
  };
}

function doError()
{		
  alert( 'Acceleration Error' );	
}

Initial URL

                                

Initial Description

                                

Initial Title
Using the Accelerometer with PhoneGap

Initial Tags
javascript, phone, mobile, web

Initial Language
JavaScript