return "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="
+lat+','+lng
+ "&radius=" +radius
+ "&types=" + "food,hospital" //???
+ "&type=point_of_interest&key=KEY";
如何让我附近的所有医院和食物?我使用“”& types =“+”食物,医院“,但这给了我附近所有类型的地方。
感谢您的回答。
答案 0 :(得分:1)
尝试使用:
String types = "food|hospital"; -- the pipe symbol
代码:
String URL = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=";
String types = "food|hospital";
String key = "your_key";
try {
placesSearchStr = URL +lat+ "," +lng+
"&radius=1000&sensor=false&types="+URLEncoder.encode(types,"UTF-8")+
"&key="+key;
return placesSearchStr;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}