The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

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 (71) [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 or 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 and, still experimental, Bluetooth devices can be accessed directly from the browser (see

Good luck! Keep us informed about what you built!
389102 (8) [Avatar] Offline
Thanks for your reply,is that a good method 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!