如何最大限度地减少对谷歌API(地)自动完成的请求量? [英] How to minimize amount of requests for Google API (places) autocomplete?

查看:134
本文介绍了如何最大限度地减少对谷歌API(地)自动完成的请求量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用谷歌API - 地自动完成在 AutoCompleteTextView 位置。我做了一些测试,也许20的搜索,并在我的谷歌开发者的个人资料,这是写的我已经200 API请求。

I am using google API - places to autocomplete locations in AutoCompleteTextView. I did couple of tests maybe 20 searches and in my profile on google devs, it's written that I have made 200 API requests.

据我所知,它正在尽我输入一些东西或编辑键入的文本时代的要求。但是,有什么办法如何减少调用量的服务器?

I understand that it is making request every time I type something or edit typed text. But is there any way how to reduce amount of calls to server?

一个想法是定义阈值3个字符。

One of ideas is to define threshold to 3 characters.

推荐答案

我觉得更好的实施方案,以减少呼叫Places API的数量将是摆在也许0.75秒延迟的最后一个键盘$ P后, $ PSS。这将避免对用户产生混淆后的3个字母看到自动完成以后谁,坐着他的打字5日之后等待。

I think a better implementation to reduce the number of calls to the Places API would be to put in a delay of maybe 0.75 seconds after the last key-press. That would avoid confusion on the part of a user who after seeing autocomplete after 3 letters, sits and waits after typing his 5th.

这篇关于如何最大限度地减少对谷歌API(地)自动完成的请求量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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