Is it possible to access GPS data in real time on a smartphone with JavaScript (without an android or ios application I mean)?
Thanks
|
Is it possible to access GPS data in real time on a smartphone with JavaScript (without an android or ios application I mean)? Thanks |
|||
|
|
|
Yes. You are looking for the Geolocation API, here's a simple demo. Here is sample code from Dive Into HTML5 and HTML Rocks. Works great from web pages hosted on iOS and Android phones, it's a simple API to use. Strictly speaking it's not GPS; it's a generic location API. On mobile devices like iPhones location is often provided by WiFi or cell tower fixes and not the GPS radio. |
||||
|
I've used solution, where Java applet was reading NMEA GPS data from serial port and wrote it to browser's global variable - where it was accessible to JavaScript. It worked well on laptop and regular browser, not sure, how it would work on smartphone. |
|||
|
|