Can I programmatically access smartphone sensors via browser and JavaScript?

Is it possible for me to programmatically access touchscreen smartphones (for example, an accelerometer, compass, etc. on an Android or iPhone device) through a browser web page and JavaScript? I know that the W3C Devices standard can provide access to the camera.

+5
source share
4 answers

HTML5 is likely to contain a sensor API. Until this is fully standardized, vendors provide their own APIs, such as Apple, for mobile Safari.

, PhoneGap , /. , , PhoneGap, , API.

, Javascript, . , ,

. https://developer.apple.com/library/safari/iPad/#documentation/SafariDOMAdditions/Reference/DeviceMotionEventClassRef/DeviceMotionEvent/DeviceMotionEvent.html .

+1

- "" "". / , - , GPS iPhone , :

iPhone JavaScript

0

iPhone , event.accelerationIncludingGravity: http://www.omiod.com/iphone/acceleration-demo.php

So far, Safari on the iPhone is the first to implement it, but I see that Android will fill this gap very soon.

0
source

All Articles