Phonegap 3.0.0-0.14.1: geolocation.getPosition() only works once on Android

293 views
Skip to first unread message

Tobias Blum

unread,
Aug 1, 2013, 9:17:32 AM8/1/13
to phon...@googlegroups.com
Hi all,

I'm experiencing the following problem on android (regardless whether I test on real device or in the simulator):
The first time after starting the app, calling geolocation.getPosition( { timeout: 15000 } ) it works great, but if the function is called a second time (after navigation to the same page again) I always get a timeout.

In logcat i can see the following exception on the second try:
08-01 15:03:53.155    4709-4709/de.nm.pw I/Web Console: deviceready() at :1161844761
08-01 15:03:53.905    4709-4709/de.nm.pw I/Web Console: getPosition() at :1161844553

08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: java.lang.NullPointerException
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at org.apache.cordova.core.GeoBroker.getCurrentLocation(GeoBroker.java:109)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at org.apache.cordova.core.GeoBroker.execute(GeoBroker.java:76)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:65)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at org.apache.cordova.PluginManager.execHelper(PluginManager.java:229)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at org.apache.cordova.PluginManager.exec(PluginManager.java:214)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:53)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at android.webkit.LoadListener.nativeFinished(Native Method)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at android.webkit.LoadListener.nativeFinished(Native Method)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at android.webkit.LoadListener.tearDown(LoadListener.java:1219)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at android.webkit.LoadListener.handleEndData(LoadListener.java:740)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at android.webkit.LoadListener.handleMessage(LoadListener.java:238)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at android.os.Looper.loop(Looper.java:130)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:645)
08-01 15:03:53.913    4709-4717/de.nm.pw W/System.err: at java.lang.Thread.run(Thread.java:1019)

08-01 15:04:08.913    4709-4709/de.nm.pw I/Web Console: Position error:3 (Position retrieval timed out.) at :1161845029

On iOS i don't experience the behaviour with the same phonegap code.

Did anyone experience this behaviour too and maybe has a solution for it?

Best regards,
Tobias

Roy A.

unread,
Oct 2, 2013, 10:33:47 AM10/2/13
to phon...@googlegroups.com
Have you found a solution?

Mike Billau

unread,
Oct 4, 2013, 9:05:29 AM10/4/13
to phon...@googlegroups.com
Can you please provide more information about your system? What version of cordova/phonegap are you using? (Type 'cordova --version' on the command line). Also, did you add the plugins correctly? The only reason I ask is because I was unable to generate this error using the recent 3.1 cordova build and a modified version of the example in the docs.
Reply all
Reply to author
Forward
0 new messages