You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Tobias Blum (JIRA)" <ji...@apache.org> on 2013/08/07 14:24:47 UTC

[jira] [Comment Edited] (CB-4521) Geolocation plugin timeouts on Android device with Cordova 3.0.X

    [ https://issues.apache.org/jira/browse/CB-4521?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13731909#comment-13731909 ] 

Tobias Blum edited comment on CB-4521 at 8/7/13 12:23 PM:
----------------------------------------------------------

Dear cordova team,

to refine the information in this issue I tried to reproduce this behaviour in a minimal example. In my case I tested with getCurrentPosition() on my Nexus 7 (4.3 stock). Could reproduce this also with an older Motorola phone (2.3.7).

These are the steps I took:
- Phonegap Version was 3.0.4
- phonegap create geolocationtest
- phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
- In "index.html" add '<a href="index.html">reload</a>' after </h1>
- In "js/index.js" add the following code in function onDeviceReady()
{code:title=When device ready|borderStyle=solid}
navigator.geolocation.getCurrentPosition(function(position) {
	console.log("Position found: " + position.coords.latitude + "#" + position.coords.longitude);
	alert("Position found: " + position.coords.latitude + "#" + position.coords.longitude);
}, function(err){
	console.log("ERROR: " + err.message);
	alert("ERROR: " + err.message);
}, { timeout: 30000, enableHighAccuracy: false }); 

{code}
- phonegap local run android (App is deployed successfully to my Nexus 7)

After the App has started, it get an alert with "Position Found..." and the corresponding output on console.log in logcat. 
When I then click the reload link on the screen, I have to wait the timeout (30 sec) and then I get the alert "ERROR: Position retrieval timed out." and in logcat I instantly get the following exception:
{code}
W/System.err(22208): java.lang.NullPointerException
W/System.err(22208): 	at org.apache.cordova.core.GeoBroker.getCurrentLocation(GeoBroker.java:109)
W/System.err(22208): 	at org.apache.cordova.core.GeoBroker.execute(GeoBroker.java:76)
W/System.err(22208): 	at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:65)
W/System.err(22208): 	at org.apache.cordova.PluginManager.execHelper(PluginManager.java:229)
W/System.err(22208): 	at org.apache.cordova.PluginManager.exec(PluginManager.java:214)
W/System.err(22208): 	at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:53)
W/System.err(22208): 	at android.webkit.JWebCoreJavaBridge.sharedTimerFired(Native Method)
W/System.err(22208): 	at android.webkit.JWebCoreJavaBridge.sharedTimerFired(Native Method)
W/System.err(22208): 	at android.webkit.JWebCoreJavaBridge.fireSharedTimer(JWebCoreJavaBridge.java:92)
W/System.err(22208): 	at android.webkit.JWebCoreJavaBridge.handleMessage(JWebCoreJavaBridge.java:108)
W/System.err(22208): 	at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(22208): 	at android.os.Looper.loop(Looper.java:137)
W/System.err(22208): 	at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:814)
W/System.err(22208): 	at java.lang.Thread.run(Thread.java:841)
{code}
The full logcat output can be found here: http://pastebin.com/JfivAAED

Best regards,
Tobias
                
      was (Author: tblum):
    Dear cordova team,

to refine the information in this issue I tried to reproduce this behaviour in a minimal example. In my case I tested with getCurrentPosition() on my Nexus 7 (4.3 stock). Could reproduce this also with an older Motorola phone (2.3.7).

These are the steps I took:
- Phonegap Version was 3.0.4
- phonegap create geolocationtest
- phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
- In "index.html" add '<a href="index.html">reload</a>' after </h1>
- In "js/index.js" add the following code in function onDeviceReady()
        navigator.geolocation.getCurrentPosition(function(position) {
            console.log("Position found: " + position.coords.latitude + "#" + position.coords.longitude);
            alert("Position found: " + position.coords.latitude + "#" + position.coords.longitude);
        }, function(err){
            console.log("ERROR: " + err.message);
            alert("ERROR: " + err.message);
        }, { timeout: 30000, enableHighAccuracy: false }); 
- phonegap local run android (App is deployed successfully to my Nexus 7)

After the App has started, it get an alert with "Position Found..." and the corresponding output on console.log in logcat. 
When I then click the reload link on the screen, I have to wait the timeout (30 sec) and then I get the alert "ERROR: Position retrieval timed out." and in logcat I instantly get the following exception:
W/System.err(22208): java.lang.NullPointerException
W/System.err(22208): 	at org.apache.cordova.core.GeoBroker.getCurrentLocation(GeoBroker.java:109)
W/System.err(22208): 	at org.apache.cordova.core.GeoBroker.execute(GeoBroker.java:76)
W/System.err(22208): 	at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:65)
W/System.err(22208): 	at org.apache.cordova.PluginManager.execHelper(PluginManager.java:229)
W/System.err(22208): 	at org.apache.cordova.PluginManager.exec(PluginManager.java:214)
W/System.err(22208): 	at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:53)
W/System.err(22208): 	at android.webkit.JWebCoreJavaBridge.sharedTimerFired(Native Method)
W/System.err(22208): 	at android.webkit.JWebCoreJavaBridge.sharedTimerFired(Native Method)
W/System.err(22208): 	at android.webkit.JWebCoreJavaBridge.fireSharedTimer(JWebCoreJavaBridge.java:92)
W/System.err(22208): 	at android.webkit.JWebCoreJavaBridge.handleMessage(JWebCoreJavaBridge.java:108)
W/System.err(22208): 	at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(22208): 	at android.os.Looper.loop(Looper.java:137)
W/System.err(22208): 	at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:814)
W/System.err(22208): 	at java.lang.Thread.run(Thread.java:841)

The full logcat output can be found here: http://pastebin.com/JfivAAED

Best regards,
Tobias
                  
> Geolocation plugin timeouts on Android device with Cordova 3.0.X
> ----------------------------------------------------------------
>
>                 Key: CB-4521
>                 URL: https://issues.apache.org/jira/browse/CB-4521
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Geolocation
>    Affects Versions: 3.0.0
>         Environment: Device: Galaxy Nexus 4.3 Stock
> PC: Ubuntu 12.04 32b
>            Reporter: Vladimir Riha
>            Assignee: Steve Gill
>            Priority: Critical
>
> Geolocation fails on Android device with "Position retrieval timeout" message. I'm trying to use it like:
> locationWatchId = window.navigator.geolocation.watchPosition(callback, onFail, {maximumAge: 10000, timeout: 10000, enableHighAccuracy: true});
> I've tried to double maximumAge and timeout and no change. The very same works with I build the project with PhoneGap 2.8.1. Here are the steps I'm doing with Cordova 3.0.1:
> cordova create hello com.example.hello HelloWorld
> cd hello/
> cordova platform add android
> cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
> ... adding more plugin...
> cordova build
> cordova run android
> The same works on iPad. I started thread [1] about it and one other user has the same problem with Cordova 3.0.4
> [1] https://groups.google.com/forum/?hl=en%3Fhl%3Den#!topic/phonegap/MP2eLY11Rlg

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira