This is a migrated thread and some comments may be shown as answers.

navigator.geolocation.getCurrentPosition doesn't work on Nexus S

13 Answers 1010 Views
Google Android
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
BLE
Top achievements
Rank 1
BLE asked on 09 Oct 2012, 01:17 AM
Using the default Hello World code from the jQuery Mobile project template as well as the Kendo UI project template in Icenium Graphite, I can't get the navigator.geolocation.getCurrentPosition code to work on the Nexus S 4G.  It works fine on the Nexus 7.  It doesn't return either success or error.  If I put in a timeout, it always times out even if I set the timeout to 5 minutes and include maximumAge and enableHighAccuracy in the options.  I have compared the device settings side-by-side and they are identical.  I have also tried watchPosition without success.  Android version on both devices is 4.1.1   Also, the Google maps app on the Nexus S 4G works fine so I know the network is working.

13 Answers, 1 is accepted

Sort by
0
BLE
Top achievements
Rank 1
answered on 09 Oct 2012, 10:59 PM
P.S. compass.watchHeading works fine (http://docs.phonegap.com/en/2.0.0/cordova_compass_compass.md.html) so I think the issue is localized to that one API group
0
BLE
Top achievements
Rank 1
answered on 10 Oct 2012, 04:28 AM
Appears to be a known issue.  See issues 36333 (https://code.google.com/p/android/issues/detail?id=36333&q=geolocation&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars) and 16346 (https://code.google.com/p/android/issues/detail?id=16346&q=geolocation&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars)
0
Evgeni "Zammy" Petrov
Telerik team
answered on 10 Oct 2012, 11:02 AM
Hi Ben,

Unfortunately geolocation is implemented by the browser in Android. We will slowly start to build knoweledge base of issues connected with different browser versions on Android.


Greetings,
Evgeni "Zammy" Petrov
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
Mat-Moo
Top achievements
Rank 1
answered on 21 Dec 2012, 02:42 PM
This is quite a big issue, many apps use geo-location to help find local places etc. I've got a HTC one X and while my ipad works, the one X doesnt! So now I'm left a bit screwed after spending a few days on my app wondering if Icenium is the right choice. 

Is there any workaround or other options, or am I back to starting again using a different platform?
0
Evgeni "Zammy" Petrov
Telerik team
answered on 25 Dec 2012, 06:06 PM
Hi Mat-Moo,

I just tested with One X and the device had its geolocation turned off for 3rd-party apps. When I turned it on it worked flowlessly. Can you check if you have turned off your geo location to 3rd-party apps? Its in "Options > Location > GPS Satellites".

All the best,
Evgeni "Zammy" Petrov
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
Mat-Moo
Top achievements
Rank 1
answered on 25 Dec 2012, 07:06 PM
Do you mean Settings -> Location -> GPS satellites? If so that is on, all options are on, on that screen, except "Location & google search"

MERRY CHRISTMAS!
0
Kristian D. Dimitrov
Telerik team
answered on 29 Dec 2012, 09:36 AM
Hi Mat-Moo,

On some Android devices  navigator.geolocation.getCurrentPosition()  won't return the geolocation, unless you set the enableHighAccuracy option to true. Try to replace your call to navigator.geolocation with this:

navigator.geolocation.getCurrentPosition(onGeolocationSuccess, onGeolocationError,{enableHighAccuracy: true});

Hope this helps.

Greetings,
kdimitrov
the Telerik team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
BLE
Top achievements
Rank 1
answered on 02 Jan 2013, 03:00 PM
enableHighAccuracy was set to true but didn't help (see my original post).  We eventually dropped support for the Nexus 7 but later I found this which might help:  http://afarkas.github.com/webshim/demos/demos/geolocation.html
0
Mat-Moo
Top achievements
Rank 1
answered on 02 Jan 2013, 10:18 PM
Yep, made no difference, secondly the sample app doesn't work either. I'm supposed to be demoing the app to my client in a few days, and I know he runs android - EEK!
0
BLE
Top achievements
Rank 1
answered on 02 Jan 2013, 10:35 PM
Unfortunately, as Zammy indicated, we're at the mercy of the OS browser view:  http://stackoverflow.com/questions/11722108/navigator-geolocation-watchposition-not-working-on-samsung-galaxy-xcover-gps-s


0
Mat-Moo
Top achievements
Rank 1
answered on 02 Jan 2013, 10:41 PM
PS Works on my Nexus 7 (running 4.2) 
0
BLE
Top achievements
Rank 1
answered on 02 Jan 2013, 10:44 PM
Yep, after updating the Nexus 7 OS it worked for me as well so I guess the lesson learned is wait awhile, download any pending system updates and try again.

For the curious, here's a nice overview from Addison Wesley's "PhoneGap Essentials" book:

A web view is a native application component that is used to render web content
(typically HTML pages) within a native application window or screen. It’s essentially
a programmatically accessible wrapper around the built-in web browser included
with the mobile device.

For some examples, on the BlackBerry platform, it’s implemented as a Browser
Field object (using net.rim.device.api.browser.field2). On Android, it’s
implemented using a WebView view (android.webkit.WebView), and on iOS, it’s a
UIWebView (System/Library/Frameworks/UIKit.framework).
0
Mat-Moo
Top achievements
Rank 1
answered on 18 Jan 2013, 09:57 AM
Updating to the latest version of Kendo Mobile has fixed my phone issue?! :)
Tags
Google Android
Asked by
BLE
Top achievements
Rank 1
Answers by
BLE
Top achievements
Rank 1
Evgeni "Zammy" Petrov
Telerik team
Mat-Moo
Top achievements
Rank 1
Kristian D. Dimitrov
Telerik team
Share this question
or