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
#1
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
#2
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
#3
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
#4
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!