Geolocation: watchPosition() always fails w/ timout on Cordova 3.0.1 on Android device

1,899 views
Skip to first unread message

Láďa Říha

unread,
Aug 6, 2013, 9:03:49 AM8/6/13
to phon...@googlegroups.com
I have a simply project, where I'm using geolocation plugin. I've added the plugin via Cordova CLI, all seems to be OK, but when I use it like

locationWatchId = window.navigator.geolocation.watchPosition(callback, onFail, {maximumAge: 10000, timeout: 10000, enableHighAccuracy: true});

Then it always fails with message "Position retrieval timeout" message (I've tried to double maximumAge and timeout). The very same works with if I build the new project with same sources but 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

Do you have any ideas? On Android device, I can see that once the watchPosition() is called, GPS is activated and searching for signal. I have also cellular data on and enabled location via Wifi and cellular data. Thanks in advance

Láďa Říha

unread,
Aug 6, 2013, 10:07:20 AM8/6/13
to phon...@googlegroups.com
The same works with iPad so it seems to be some issue with Android and geolocation plugin....

Kaan Soral

unread,
Aug 6, 2013, 1:53:42 PM8/6/13
to phon...@googlegroups.com
geolocation failed silently when I tested it on Android, callbacks never get called etc. So I decided to wait until a new version etc. might check the situation again now, with a clean project

Is 3.0.1 a typo? it kind of got me excited - however the docs seem to be at 3.0.0

Láďa Říha

unread,
Aug 6, 2013, 4:35:28 PM8/6/13
to phon...@googlegroups.com
It is just kind of sad, such a regression. Version 3.0.1 is not a typo, npm offers also version 3.0.5 to install. I'll try it if it helps.


--
S pozdravem, Láďa Říha



2013/8/6 Kaan Soral <kaan...@gmail.com>
--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
---
You received this message because you are subscribed to a topic in the Google Groups "phonegap" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phonegap/MP2eLY11Rlg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Kaan Soral

unread,
Aug 6, 2013, 8:06:01 PM8/6/13
to phon...@googlegroups.com
Tested with 3.0.4, still same issue

does getPosition work for you?

I've checked the permissions etc, doesn't seem to be a permission issue, it just doesn't respond

There are discussions about other plugins failing silently, however didn't see any geolocation ones

Tobias Blum

unread,
Aug 7, 2013, 5:28:50 AM8/7/13
to phon...@googlegroups.com
Dear all,

Unfortunately didn't get a response. I can reproduce the behaviour on android with a Nexus 7 or a older Motorola phone.

Láďa, do you also get the exception I mentioned in my initial post?

Best Regards, Tobias

Láďa Říha

unread,
Aug 7, 2013, 5:42:51 AM8/7/13
to phon...@googlegroups.com
Thanks for the link, I'll have a look at it but right now I'm only printing error message from onFail callback like

window.console.error(error.message);

and it says "Position retrieval time out", like it does in your case. So I think this is the same case. I filled issue against it https://issues.apache.org/jira/browse/CB-4521 so hopefully someone look at it.


--
S pozdravem, Láďa Říha



2013/8/7 Tobias Blum <bl...@socialworkplace.de>

Tobias Blum

unread,
Aug 7, 2013, 8:28:25 AM8/7/13
to phon...@googlegroups.com
I got the full exception from logcat when the phone was connected to my computer.

I made some additional checks with a fresh minimal project and added the results to the issue:

I hope someone will have a look at it, as geolocation is not usable for me at the moment.

Best regards,
Tobias

André Coelho

unread,
Aug 7, 2013, 4:46:50 PM8/7/13
to phon...@googlegroups.com
Hello,

I'm having the same issue with version 2.9.0 and I've been cracking at it for a while. Still can't get it to work.
If I manage to find a way to make it work I'll post it here and I would appreciate it if you guys could do the same.

Best regards,
André

Tobias Blum

unread,
Aug 8, 2013, 10:37:02 AM8/8/13
to phon...@googlegroups.com
Dear André,

maybe it's a good idea to comment on the issue at apache.org mentioned before und vote it up, to draw a bit attention on it.

Best regards,
Tobias
Reply all
Reply to author
Forward
0 new messages