我只是在 Android 中重建我的 iOS 应用程序,到处都是可怕的事情。一个可怕的部分是地图的东西。
我需要通过查询等来获取用户位置周围的位置"park", "cafe", "bakery"
。在swift中我刚刚使用了localSearchRequest.naturalLanguageQuery
self.localSearchRequest = MKLocalSearchRequest()
self.localSearchRequest.naturalLanguageQuery = mapSearchQuery
self.localSearchRequest.region = region
self.localSearch = MKLocalSearch(request: self.localSearchRequest)
for item in localSearchResponse!.mapItems
let annotation = MKPointAnnotation()
annotation.coordinate = item.placemark.coordinate
annotation.title = item.name
self.mapView.addAnnotation(annotation)
}
有没有类似的方法在 Android 中使用 GoogleMaps API 做同样的事情?我发现的唯一方法是通过 JSON 从https://developers.google.com/places/web-service/search获取它们,我什至不确定这是否适用于 Android 应用程序。
适用于 Android 的 GooglePlaces API 仅列出某个位置周围的所有地点,而无法过滤它们或其他东西。