Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Decrease amount of Google Places autocomplete requests

Since June 22, 2016, the Google Maps Javascript API requires a key (again). This means they're tracking your usage. When you use the Google Places API in an AutoComplete textbox, a request is made for every character you type meaning that if you search in such a textbox for a city that contains 10 characters, you consumed 10 requests for that day.

I want to lower the amount of requests by setting a time-out before updating the autocomplete popup (like: "wait 750ms before triggering the request"), but I can't find a way to do it.

Is there a way to lower the amount of requests used by the Google Places Javascript API Autocomplete component?

Edit: I am aware of this article but that handles the Android API, I'm using the JavaScript API.

like image 613
Auric Avatar asked Apr 10 '26 21:04

Auric


1 Answers

You can build your own widget using the AutocompleteService class, and set your own thresholds.

But honestly, I would hate an app that takes such a long time to react to my keystrokes. I would initially blame the phone for not reacting to my touches, but likely realize, eventually, that it is just this one app that is slow to react to my keystrokes, and find a replacement app. Consider that.

like image 154
miguev Avatar answered Apr 12 '26 09:04

miguev