Reputation: 29
return "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="
+lat+','+lng
+ "&radius=" +radius
+ "&types=" + "food,hospital" //???
+ "&type=point_of_interest&key=KEY";
How can I get all hospitals and food near by me? I use ""&types=" + "food,hospital", but this gives me all types of places near me.
Thank you for your answers.
Upvotes: 0
Views: 194
Reputation: 23881
Try using:
String types = "food|hospital"; -- the pipe symbol
in code:
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();
}
Upvotes: 1