Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is it possible to access GPS data in real time on a smartphone with JavaScript (without an android or ios application I mean)?

Thanks

share|improve this question

3 Answers 3

up vote 10 down vote accepted

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.

share|improve this answer
1  
Thanks for the answer! So, there is no way to force GPS radio location? –  nippo Nov 17 '12 at 21:27
2  
Not via the GeoLocation API, no. Also it doesn't provide GPS-specific information like satellite signal strength, etc. –  Nelson Nov 17 '12 at 21:44

Hope this will help. I wrote html 5 mixed with JavaScript and Ajax (to write data on my website coordinates). I use Android samsung (2 years old from now on) to do tests.

When a Wifi button is on the wifi connexion works fine I can see longitude and latitude changing (GPS and Data buttons are off).

When GPS and DATA buttons are on (and wifi button off) geolocation coordinates longitude and latitude are frozzen (no updates)... no change...

one possible anwser can be here found on this answered Jun 6 '13 at 6:51 by Eduardo: http://stackoverflow.com/a/16955512

I tested it, and it worked for me...

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.