2016-10-08 44 views
0

我想填充谷歌地圖與用戶附近的地方,如酒店,餐廳等。 不幸的是我無法找到一個支持Xamarin機器人和地方API在xamarin android 任何建議如何實現這一目標?填充地圖附近的地方在Xamarin安卓使用地方API

+0

使用場所的網絡API:http://stackoverflow.com/questions/29087675/requests-poi-from-a-location-using-xamarin-android –

+0

你會使用代碼在那裏的答案,並用與在這裏答案的網址:http://stackoverflow.com/questions/30161395/im-trying-to-search-nearby-places-such-as-banks-restaurants-atms-inside-the-d –

回答

4

您正在尋找Xamarin.GooglePlayServices.Places的NuGet:

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

一旦添加到您的Xamarin.Android項目,你可以在廣場的API添加到您的GoogleApiClient

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

的地方API是在Android.Gms.Location.Places命名空間。

+0

似乎是一個解決方案,我是新的Xamarin Android可以告訴我如何使用這個。使用上面的代碼 .EnableAutoManage(this,this)給出的紅線錯誤表示無法從App4轉換爲Android .Support,V4.AppFragment Activity,並且無法從App4轉換爲System.Android 這些(this,this)下分別出現兩個紅色下劃線錯誤 – 1105121472

+0

https://developers.google.com/places/android-api/start – SushiHangover

+0

升級Xamarin.GooglePlayServices包後需要添加nuget包Xamarin.GooglePlayServices。 PlacesClass類的地方。 – mvandillen