This is the first in a three part series where I build a Xamarin Forms app that uses the Azure Maps service. You can check out the other parts here:
The new Azure Maps service is available, offering APIs and services that enable several common scenarios for location aware apps, all in one convenient place. This is actually an impressive set of services, namely Search, Maps, Geocoding, Traffic, Routing, and even time zones!
As soon as I saw this I thought why not build a Xamarin Forms app and use the Maps API to get POI data based on your location and display the results on a map? So that’s what I did.
Its a simple proof of concept, one screen mobile app for Android. The screen contains a Map and a search bar. I used Xamarin.Forms.Maps Nuget package to display the map. When you enter a search term, I query the Azure Maps Fuzzy Search REST API endpoint to sesrch for Points of Interest using the term you enter into the search box. To get results local to you, I pass in the Lat and Long of your current location which I obtain by using the Geolocator Plugin. Since the results of the API can be returned as JSON, I parse the JSON into my model, which I created using QuickType IO. Then I simply loop through the results and add each of them to the map as a map Pin. When you tap on a map pin, it shows you the venue name and address. So that’s it, it was actually pretty easy to get started! Here’s a screenshot from my Android Emulator with a simulated location.