389102 (8) [Avatar] Offline
Can I use smartphone built-in sensor (G-sensor,O-sensor or temperature sensor) to deploy a web of thing?
Thank you in advance
domguinard (69) [Avatar] Offline
Yes, that's a good idea!

What you need to do is to create a new plugin that communicates with your smartphone to get the sensor data. Then the Pi acts as a gateway to your phone. Ideally you would use REST on the phone but that's not a must as the plugin will abstract whatever protocol you decide to use (see Chapter 7). If you want to implement a REST API for your phone then try https://restlet.com/projects/restlet-framework/ or https://github.com/koush/AndroidAsync two projects that support HTTP/WebSockets servers for Android phones.

Note that some sensors on smartphones are now accessible directly from the browser. For instance the GPS is accessible via the HTML5 GeoLocation API (see https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation) and, still experimental, Bluetooth devices can be accessed directly from the browser (see https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web?hl=en)

Good luck! Keep us informed about what you built!
389102 (8) [Avatar] Offline
Thanks for your reply,is that a good method https://github.com/jxcore/jxcore-cordova to use nodejs in smartphone?
thanks a lot!
Vlad Trifa (16) [Avatar] Offline
Hello there, yes this is a pretty good option as using it within cordova gives you the advantage of easily porting your code accross devices (and especially to let you run node.js on iphones). But we've never tried it yet so please let us know what you think!