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.

navigator.geolocation.getCurrentPosition(onGeoSuccess,onGeoError);

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.

Comments

Popular posts from this blog

Fixing Error "Failed to load VMMR0.r0 (VERR_SUPLIB_WORLD_WRITABLE)" in Virtualbox

Create new Java Class files at runtime

Using iReport plugin for Jasper Reports in Netbeans