我正在尝试将 Google Places API 集成到我的应用程序中。 现在我找到了手机的当前位置,如何将我得到的经度和纬度嵌入到以下 URL 而不是“location=34.0522222,-118.2427778”
“https://maps.googleapis.com/maps/api/place/search/xml?location=34.0522222,-118.2427778&radius=500&types=restaurants&sensor=false&key=Your_API_Key”
最佳答案
你的意思是你如何进行字符串操作,例如(未测试):
int latitude = ...;
int longitude = ...;
String preamble = "https://maps.googleapis.com/maps/api/place/search/xml?location=";
String postamble = "&radius=500&types=restaurants&sensor=true&key=";
String key = "Your_api_key";
String latStr = latitude + "";
String longStr = longitude + "";
String url = preamble + latStr + "," + longStr + postamble + key;
关于android - 在 Google Places API 中传递当前位置(经度和纬度),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10018033/