Geolocation: Geolocator vs navigator.geolocation RRS feed

  • Question

  • Hello guys.

    I've started looking at the geocation api and I'd like to know your opinion about getting the current location. Is there anything which the Geolocator object gives me that I can't get from the geolocation browser api (navigator.geolocation)? At first sight, it seem like they both do the same thing, so I'm not sure on why the team didn't reuse the API we had from the browser...


    Luis Abreu

    Sunday, May 20, 2012 8:46 PM

All replies

  • Hi Luis,

    They should give you the same thing.  Remember that the WinRT API is used across all Metro style app languages.  The projection is the same for .NET and JS and that is why you see both in JS.


    Jeff Sanders (MSFT)

    Monday, May 21, 2012 11:40 AM
  • Ok, I understand the projection idea, but there are several areas where things are different. for instance, layouts...anyways, I couldn't find any big difference either, so I guess using each one is a matter of personal preference..,


    Luis Abreu

    Monday, May 21, 2012 6:27 PM
  • Hello,

    I was wondering the same thing as well. Some of the users of my application ("Maps Pro") say that the application doesn't seem to use the GPS, only the network location. I am using navigator.geolocation, not the Device.Geolocation object and I was wondering if only the Device.Geolocation was using the GPS data or if IE10 had some kind of hook into the HTML5 api and using navigator.geolocation would also use the GPS.

    Can't really find any documentation and as I don't have a Windows 8 hardware with a GPS chip, I have no way to find out / debug



    Wednesday, January 16, 2013 9:29 PM
  • For what it's worth, I recently posted a detailed comparison between the two APIs on my blog, see http://kraigbrockschmidt.com/blog/?p=234. Here's the last bit from the post:

      • Geolocation options: The movementThreshold option is unique to WinRT, which is used for system power management and which allows an app to only receive readings there has been enough of a change. This is helpful for geo-fencing apps that only want to update themselves when the user has moved far enough away from a given point. To do the same with the HTML5 API requires more frequent location polling and calculating distance to filter out events.
      • Position information: When address information is supported by a location provider, WinRT provides for surfacing that data through the civicAddress property (and its individual sub-properties).

      Thus, developers with existing HTML5 geolocation code, or those who want to maintain as much platform-neutral code in their apps as possible, will likely use the HTML5 API [as you must also do in the web context]. On the other hand, the convenience of movementThreshold and its positive effect on power management is a significant benefit of the WinRT API.


    Author, Programming Windows 8 Apps with HTML, CSS, and JavaScript, a free ebook from Microsoft Press

    Thursday, January 17, 2013 12:04 AM
  • Ok, thanks a lot for sharing that article. So it sounds like both will grab GPS if present and fallback on Network if not, it's just that the WinRT API is for building it outside of the web context



    Thursday, January 17, 2013 8:00 AM