gpt4 book ai didi

android - 谷歌地图放置 api 在 android 中没有给出正确的结果

转载 作者:行者123 更新时间:2023-11-29 22:19:13 25 4
gpt4 key购买 nike

在我的应用程序中,我试图获取我当前位置附近的美容院位置。为此,我正在使用 google places API。如链接中所述,我正在尝试获取有关我附近美容院的所有信息。为此,我使用以下代码

private void onPerformSearch() {

double lat=gePoint_pt.getLatitudeE6()/1E6;
double lon=gePoint_pt.getLongitudeE6()/1E6;

String url="https://maps.googleapis.com/maps/api/place/search/xml?";
url=url.concat("&location="+lat+","+lon);
//url=url.concat("&location="+gePoint_pt);
url=url.concat("&radius="+1000);
url=url.concat("&types="+"beauty"+"_"+"salon");
url=url.concat("&name=");
url=url.concat("&sensor="+"true");
url=url.concat("&key=*******");
Log.i("url=========",""+url);
try {

HttpClient client=new DefaultHttpClient();
HttpGet request = new HttpGet();
request.setURI(new URI(url));
HttpResponse response = client.execute(request);
HttpEntity resEntity = response.getEntity();
if (resEntity != null)
{
//get web service responce
String res_str=EntityUtils.toString(resEntity);
Log.i("RESPONCE======",""+res_str);
if(res_str!=null)
{
parse(res_str);
}

}
}
catch (Exception e) {
e.printStackTrace();
}





}

但现在我的问题是,每当我调用此方法时,我总是得到“零结果”作为美容院的回应。但是当我对 atm 机器进行相同的尝试时,它会给我正确的结果。当我尝试使用谷歌地图搜索相同的东西时,它给了我正确的回应。即它显示了我附近的所有美容院。

最佳答案

这对我有用:

http://maps.google.com/maps?q=beauty%20salon&mrt=yp&sll=lat,lon&output=kml

其中 lat,lon 是双纬度和经度。

edit: 这是由 OP 回答的,使用 name 参数而不是 types,这很奇怪,因为 Places 文档清楚地说使用 types 参数。这在美国/英国等地也不需要,仅适用于印度的地方。我希望谷歌尽快解决这个问题。

关于android - 谷歌地图放置 api 在 android 中没有给出正确的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7709100/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com