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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.