繁体   English   中英

Android Google商家信息自动填充功能无法正常运行

[英]Android Google Places autocomplete api bounds not working

我希望能够通过使用google places api自动完成一些地方。 我只想包括某个地区的某些地方。 Googles API文档通过使用函数setBoundsBias来描述此功能,但我似乎无法使其正常工作,因为它仍然返回指定区域外的结果。

try {
            Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY)
                    .setBoundsBias(new LatLngBounds(
                            new LatLng(16.371163, 21.051073),
                            new LatLng(16.725743, 21.424006)))
                    .build(getActivity());

            startActivityForResult(intent, requestCode);
        } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
            e.printStackTrace();
        }

setBoundsBias应该从区域外返回结果。 这只是一种偏见。 如果要从边界内独占返回结果,则必须使用AutocompleteFilter 不幸的是,目前按地区划分的唯一级别是国家/地区。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM