Handling location updates

Our next step is to build the MapPageViewModel; this view model will contain the IGeolocator we just built. We will also be listening for location updates from the observable sequence and processing latitude and longitude values to gather address details.

Let's begin with the constructor:

public MapPageViewModel (INavigationService navigation, IGeolocator geolocator, Func<Action, ICommand> commandFactory, IGeocodingWebServiceController geocodingWebServiceController) : base (navigation) { _geolocator = geolocator; _geocodingWebServiceController = geocodingWebServiceController; _nearestAddressCommand = commandFactory(() => FindNearestSite()); _geolocationCommand = commandFactory(() => { if (_geolocationUpdating) { geolocator.Stop(); ...

Get Xamarin Blueprints now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.