1

I am trying to populate a google map with user's near by places like Hotels, Restaurants etc.. Unfortunately i am unable to find a support for xamarin android and place API in xamarin android Any suggestions how to achieve this?

Syed
  • 96
  • 8
  • Use the places web API: http://stackoverflow.com/questions/29087675/requests-poi-from-a-location-using-xamarin-android – Daniel Nugent Oct 08 '16 at 17:44
  • You would use the code in the answer there, and substitute the URL with the one in the answer here: http://stackoverflow.com/questions/30161395/im-trying-to-search-nearby-places-such-as-banks-restaurants-atms-inside-the-d – Daniel Nugent Oct 08 '16 at 17:47

1 Answers1

5

You are looking for the Xamarin.GooglePlayServices.Places nuget:

<package id="Xamarin.GooglePlayServices.Places" version="32.940.0-beta3" targetFramework="monoandroid70" />

Once added to your Xamarin.Android project, you can add the Place APIs to your GoogleApiClient:

mGoogleApiClient = new GoogleApiClient
.Builder(this)
.AddApi(PlacesClass.GEO_DATA_API)
.AddApi(PlacesClass.PLACE_DETECTION_API)
.EnableAutoManage(this, this)
.Build();

The Places APIs are in the Android.Gms.Location.Places namespace.

SushiHangover
  • 73,120
  • 10
  • 106
  • 165
  • That seems to be a solution, I am new in xamarin Android can you tell me how to use this. Using the above code .EnableAutoManage(this, this) gives the redline error that says cannot convert from App4 to Android .Support,V4.AppFragment Activity and cannot convert from App4 to System.Android these two red underline errors appears under (this,this) respectively – Syed Oct 09 '16 at 20:55
  • Got here after upgrading Xamarin.GooglePlayServices package and needed to add the nuget package Xamarin.GooglePlayServices.Places for the PlacesClass class. – mvandillen Mar 15 '17 at 10:48