How to get GPS coordinates in the browserSupport


Last Updated:

  1. snakebite

    snakebite New Member This Topic's Starter

    Joined:
    Aug 8, 2009
    Messages:
    1
    Likes Received:
    0
    Is it possible to be get GPS coordinates in the browser? I wan to use it in a web page but i can't find any info about that.
     

    Advertisement
  2. jeling

    jeling New Member

    Joined:
    Sep 9, 2009
    Messages:
    4
    Likes Received:
    0
  3. shadydude

    shadydude Member

    Joined:
    Nov 13, 2009
    Messages:
    6
    Likes Received:
    0
    That's not true. Gowalla is doing it straight from the browser. Try it yourself: m.gowalla.com
     
  4. shadydude

    shadydude Member

    Joined:
    Nov 13, 2009
    Messages:
    6
    Likes Received:
    0
    Take a look at this example:

    Where Am I?

    This will not use your gps because you're not asking for high accuracy:

    navigator.geolocation.getCurrentPosition(positionSuccess, positionError);

    If you add the High Accuracy option, it will use the GPS but won't have time to get a lock or self update it if it already has a lock.

    navigator.geolocation.getCurrentPosition(positionSuccess, positionError, { enableHighAccuracy:true });

    To keep updating the position using the GPS signal which will take some seconds to lock you will have to use a line like this:

    navigator.geolocation.watchPosition(positionSuccess, positionError, { enableHighAccuracy:true });

    But in this example you'll end up adding several markers to the map instead of changing its position.

    Good luck!
     
  5. smaryka

    smaryka New Member

    Joined:
    Oct 22, 2010
    Messages:
    4
    Likes Received:
    0
    I am trying to get geolocation working in WebViews without much luck, so I tried the url provided:

    Where Am I?

    From the device emulator I can't get the geolocation to work even from the Chrome browser. It says "Detecting Location" but comes back with "Your location is currently unknown".

    Is there something about the emulator that works differently? Geolocation is enabled in the browser options. The link works as expected from Firefox on my desktop.

    [​IMG]

    Steve
     

    Attached Files:

  6. smaryka

    smaryka New Member

    Joined:
    Oct 22, 2010
    Messages:
    4
    Likes Received:
    0
    You need to use an AVM based on the Google APIs, not the Android API's to get geolocation working in the emulator.

    Steve
     

Share This Page

Loading...