Accelerometer Package

What’s the package for using Accelerometer in Meteor application?

For Cordova this one seems the most recent? GitHub - apache/cordova-plugin-device-motion: Apache Cordova Plugin device-motion What exactly have you tried? There is no Meteor package yet available but Meteor can just use the Corova packages or you can create a wrapper for it.

Thanks lucfranken, i have added it using meteor add cordova:cordova-plugin-device-motion@1.1.1 but i am still unable to use device accelerometer, i want to count the user steps using the device accelerometer.

Any help will be appreciated.

Thank you.

What are your results from debugging? Do the objects get initiated?

No, when i am running the code given below i get the following error

 Uncaught TypeError: Cannot read property 'getCurrentAcceleration' of undefined

code

Meteor.startup(function(){
	navigator.accelerometer.getCurrentAcceleration(
      onSuccess, onError);
});

     
function onSuccess(acceleration) {
	
  var accElement = 
    document.getElementById('count');
    
  accElement.innerHTML  =  
    'Acceleration X: ' + acceleration.x + '<br />' +
    'Acceleration Y: ' + acceleration.y + '<br />' +
    'Acceleration Z: ' + acceleration.z + '<br />' +
    'Timestamp: '      + acceleration.timestamp;
}
function onError(error) {
  // Handle any errors we may face
  alert('error');
}

Resolved :smile: you can use meteor shake:shake package for accelerometer.