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

14 posts, 0 answers
  1. BLE
    BLE avatar
    46 posts
    Member since:
    Sep 2012

    Posted 08 Oct 2012 Link to this post

    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.
  2. BLE
    BLE avatar
    46 posts
    Member since:
    Sep 2012

    Posted 09 Oct 2012 Link to this post

    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
  3. BLE
    BLE avatar
    46 posts
    Member since:
    Sep 2012

    Posted 09 Oct 2012 Link to this post

    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)
  4. Evgeni "Zammy" Petrov
    Admin
    Evgeni "Zammy" Petrov avatar
    168 posts

    Posted 10 Oct 2012 Link to this post

    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.
  5. Mat-Moo
    Mat-Moo avatar
    103 posts
    Member since:
    Nov 2012

    Posted 21 Dec 2012 Link to this post

    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?
  6. Evgeni "Zammy" Petrov
    Admin
    Evgeni "Zammy" Petrov avatar
    168 posts

    Posted 25 Dec 2012 Link to this post

    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.
  7. Mat-Moo
    Mat-Moo avatar
    103 posts
    Member since:
    Nov 2012

    Posted 25 Dec 2012 Link to this post

    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!
  8. Kristian D. Dimitrov
    Admin
    Kristian D. Dimitrov avatar
    68 posts

    Posted 29 Dec 2012 Link to this post

    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.
  9. BLE
    BLE avatar
    46 posts
    Member since:
    Sep 2012

    Posted 02 Jan 2013 Link to this post

    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
  10. Mat-Moo
    Mat-Moo avatar
    103 posts
    Member since:
    Nov 2012

    Posted 02 Jan 2013 Link to this post

    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!
  11. BLE
    BLE avatar
    46 posts
    Member since:
    Sep 2012

    Posted 02 Jan 2013 Link to this post

    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


  12. Mat-Moo
    Mat-Moo avatar
    103 posts
    Member since:
    Nov 2012

    Posted 02 Jan 2013 Link to this post

    PS Works on my Nexus 7 (running 4.2) 
  13. BLE
    BLE avatar
    46 posts
    Member since:
    Sep 2012

    Posted 02 Jan 2013 Link to this post

    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).
  14. Mat-Moo
    Mat-Moo avatar
    103 posts
    Member since:
    Nov 2012

    Posted 18 Jan 2013 Link to this post

    Updating to the latest version of Kendo Mobile has fixed my phone issue?! :)
Back to Top