-
Notifications
You must be signed in to change notification settings - Fork 1
PhoneGap Plugin for Sensors
jmcanterafonseca/SensorGapPlugin
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a work still in progress. This is a PhoneGap plugin that allows you to get access to the sensors available from a device. The implementation is based on Android's NDK public interface to sensors. Examples of use are: var sensorCnx = new SensorConnection('Temperature'); sensorCnx.onsensordata = function(e) { if(e.data > 20.0) { window.console.log('Temperature is too high!!!!'); } }; var watchOptions = { interval: (15 * 60 * 1000) }; sensorCnx.startWatch(watchOptions); ----------- var sensorReq = navigator.sensors.list(); sensorReq.onsuccess = function() { for(var count = 0; count < this.result.length; count++) { window.console.log("Hosted Sensor: " + this.result[count].type); } }; sensorReq.onerror = function() { window.console.error(this.error.code); }; ------------- var accel = new SensorConnection('Accelerometer'); accel.onsensordata = function(e) { window.console.log("Accelerometer data: " + e.data.x + ", " + e.data.y) }; accel.startWatch(1000); The API spec is at http://cantera.orgfree.com/specs/sensors/latest
About
PhoneGap Plugin for Sensors
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published