Skip to main content
 首页 » 编程设计

c#之使用 Place API 在 xamarin android 中填充附近地点的 map

2024年01月31日32wuhuacong

我正在尝试用用户附近的酒店、餐馆等地点填充谷歌地图。 不幸的是,我无法找到对 xamarin android 的支持并将 API 放在 xamarin android 中 有什么建议可以实现吗?

请您参考如下方法:

您正在寻找 Xamarin.GooglePlayServices.Places nuget:

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

添加到您的 Xamarin.Android 项目后,您可以将 Place API 添加到您的 GoogleApiClient:

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

Places API 位于 Android.Gms.Location.Places 命名空间中。