Wednesday, May 30, 2012

Using Geolocation API in phone gap

I am currently developing a Phonegap application for Google summer of Code 2012. I encountered some problems when using it and this is how I corrected them.

Location not available- In android emulator does not automatically get the location. So we have to send a moc location to the emulator using DDMS perspective in eclipse.

Phonegap documentation says to use the below method to get location.


But this gave me an error with error code 2 unable to start geolocation service. I corrected it using the below method.

navigator.geolocation.getCurrentPosition(onGeoSuccess,onGeoError,{ enableHighAccuracy: true });

Note - This is only for testing in the emulator.

No comments:

Post a Comment