0

I am trying to use the Bing Maps SDK to display a map in which I show a SearchView. In this SearchView I want to search for locations and when I click on a suggested location, put a marker on the map at that location.

I have previously used the HERE SDK which has a documentation to do this but on Android I can't find any documentation about this Bing Maps SDK.

What I want to achieve is this in Android: https://www.bing.com/api/maps/sdk/mapcontrol/isdk/autosuggestui#TS

UyerBit
  • 71
  • 6

1 Answers1

0

Documentation on Bing Maps autosuggest service can be found here: https://learn.microsoft.com/en-us/bingmaps/rest-services/autosuggest

You can use this with Androids AutoCompleteTextView to create a suggestion UI. You will retrieve the suggestions asynchronously from the above service. Here are a few good samples:

https://www.truiton.com/2018/06/android-autocompletetextview-suggestions-from-webservice-call/

How to implement autocompletetextview in Android Studio with an API call?

This service does not return coordinates. This is done so that it isn't used as a replacement for the geocoding service and thus allows them to make this a lower cost service. When a suggestion is selected by the user, you will need to make a single call to a geocoder to get the coordinates of the formattedAddress, then you can use that to display a marker on the map. I recommend setting the result limit to 1 since you only want to top result.

In summary;

  1. Use addTextChangedListener event of AutoCompleteTextView to retrieve suggestions from the autosuggest service.
  2. Use setOnItemClickListener event of AutoCompleteTextView to retrieve the selection from the user, and pass the formattedAddress value into the geocoding service.
  3. Use the coordinates from the geocoder response to create a marker and add to the map.
rbrundritt
  • 16,570
  • 2
  • 21
  • 46