Reputation: 70160
Windows Phone 8 has the GeoCoordinateWatcher
which is present in Windows Phone 7, but it also has Geolocator
, both of which perform the same function, i.e. allow you to 'watch' for changes in geolocation. I can't find any information about whether GeoCoordinateWatcher
is deprecated, whether Geolocator
should now be used - or the differences between the two.
Any ideas?
Upvotes: 10
Views: 3843
Reputation: 161
Not just they have the same function, but Geolocator is really fast, i've made some testing, and while a good old GeoCoordinateWatcher gets your position in about 3 seconds in a rough area, GeoLocator takes about 0.3 seconds to locate you. So win for the GeoLocator.
By the way, I think that by "Geolocator can run in the background", they refer to use it like they use in this example: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662935(v=vs.105).aspx
That is, without the limitations of a Background Agent. I would recommend we start adopting GeoLocator, unles off course, you're targetting both WP 7.8 and WP8
Upvotes: 0
Reputation: 386
Additionally, Geolocator can be used in the background while GeoCoordinateWatcher cannot.
I wrote about it when the WP8 SDK leaked. My post is below if you want to take a look but I believe the MSDN documentation should cover it somewhere as well.
Hope this additional info is useful.
Upvotes: 2
Reputation: 10620
Simple - if you don't need or plan version for WP7, only for WP8, then use the Geolocator - it is better configurable than GeoCoordinateWatcher.
Or, there is another solution that I have used in my app, use Dependency Injection and implement common interface for your geolocation service, that will be implemented using Geolocator in WP8 version and using GeoCoordinateWatcher in WP7.
Upvotes: 7