谷歌的地方自动填充API安卓界限不工作 [英] Google places autocompletes API Android : bounds not working

查看:219
本文介绍了谷歌的地方自动填充API安卓界限不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我定义我的范围如下:

private static final LatLngBounds BOUNDS_CHENNAI = new LatLngBounds(
        new LatLng(12.8339547, 80.0817007), new LatLng(13.2611661, 80.33632279999999)); // Chennai city bounds.

创建Goolge的API客户端如下:

Creating Goolge API client as follow:

mGoogleApiClient = new GoogleApiClient.Builder(this)
            .enableAutoManage(this,this)
            .addApi(Places.GEO_DATA_API)
            .addConnectionCallbacks(this)
            .build();

和使用这些边界适配器如下:

And using those bounds in adapter as follow:

PendingResult<AutocompletePredictionBuffer> results =
                Places.GeoDataApi
                        .getAutocompletePredictions(mGoogleApiClient, constraint.toString(),
                                mBounds, mPlaceFilter);

根据文档应该是奈全市范围内还给我唯一的位置,但它从世界各地返回我的位置。

According to the documentation is should return me only location within Chennai city, but it returns me location from around the world.

例如。当我输入索拉返回艾哈迈达巴德市的索拉之路而不是显示范围内匹配的结果。

E.g. When I type "Sola" it returns "Sola road" of Ahmedabad city instead of showing matched results within bounds.

推荐答案

我有android系统的界限同样的问题。我用尽了一切并不能解决这个问题。

I have the same problem with the bounds in android. I've tried everything and can't solve the problem.

对于其他网页的展望,我试图设置界限的区域时,发现​​这对JavaScript的文档中:

Looking for other web pages, i found this in the documentation for javascript when trying to set bounds to an area:

结果偏向,但不限于,包含在这些范围内的地方。

The results are biased towards, but not restricted to, Places contained within these bounds.

它看起来像Android的地方API文档是不完整的。我们将不得不等待。

It looks like the android places api documentation is not complete. We will have to wait.

这篇关于谷歌的地方自动填充API安卓界限不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆