Mobile app version of vmapp.org
Login or Join
Turnbaugh106

: How to receive sensor input, eg. gyroscope? (existing technology or future proposals) Is there currently a way to for a web application to receive data from mobile device's sensors (eg. gyroscope,

@Turnbaugh106

Posted in: #Mobile

Is there currently a way to for a web application to receive data from mobile device's sensors (eg. gyroscope, accelerometer, compass) through its browser?

If not, do any formal proposals exist for how this might be achieved in the future?

10.04% popularity Vote Up Vote Down


Login to follow query

More posts by @Turnbaugh106

4 Comments

Sorted by latest first Latest Oldest Best

 

@Hamaas447

A friend pointed me towards PhoneGap, a platform that compiles HTML/CSS/Javascript into smart-phone applications, and allows native API calls (to access sensor data among other things) through an extended library of JavaScript-like functions.

This effectively affords web developers access to smart-phone sensors with their existing development paradigm, albeit deployed via an installable application rather than accessible from an arbitrary browser.

It's not exactly what I asked for, but I think it's the closest thing that exists right now.

10% popularity Vote Up Vote Down


 

@Karen161

Hey, interesting question. I think the answer will require a little bit more of light from infrastructure point of view.

OK, we have mobile devices, with different sensors, just invented, and they need to be explored.

Currently, only Safari has some support for it.

But note that what you asked depends on many things other than just HTML and Javascript API's.

It needs device send to its firmware/OS the sensor capture. This input will be processed by OS, who will pass this signal to the application. The application by its turn, should have events that bubbles, and also a callback function already made to process the event (will, from this point onwards, it is the same thing as a click or a mouse over).

But the tricky part is the application, in our case, the browser, have this event bubbling, and allowing an interface so we can attach functions to those. This entirely depends on browsers and devices manufacturers.

So far I do not know any that is capable of process an event like onTilt, onShake or onBounce.

That's is what limit us to develop the apps you asked.

10% popularity Vote Up Vote Down


 

@Cofer257

You can partially detect a phone's orientation using CSS3 Media Queries and detecting the current width/height. This is only 2 values, with no sliding scale.

Unfortunately, there aren't any input methods on the web apart from mouse and keyboard at the moment. However, with the modular format of HTML5 it's certainly possible a spec for other input types like orientation might exist in a few years.

10% popularity Vote Up Vote Down


 

@Ogunnowo487

HTML5 has a GeoLocation API that can be accessed via JavaScript, as explained in this article.

Edit: misread question; DNS LOC doesn't apply here.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme