O'Reilly logo

PhoneGap 3.x Mobile Application Development HOTSHOT by Kerri Shotts

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exploring geolocation

Geolocation is one of those rare APIs that does what it was made for very simply and with a minimum of fuss; it's a very succinct API. There's also another benefit: as a W3C standard, many browsers have implemented it and it isn't specific to Cordova/PhoneGap.

What Cordova/PhoneGap does offer, however, is akin to a polyfill. If the browser implementation being used does not support geolocation, then Cordova/PhoneGap will provide its own implementation. As such, what works on one platform can work on many different platforms, including desktop browsers.

The API documentation can be found at https://github.com/apache/cordova-plugin-geolocation/blob/dev/doc/index.md.

Getting ready

Before you use the geolocation features, be sure ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required