iOS Question API Key, geocoder and quota

marcick

Well-Known Member
Licensed User
Longtime User
I'm doing a massive use of geocoder (Ilocation library) and tuning my app to not exceed the usage quota.
Actually I have a 300mS timer that delay each Geocoder request, it should be enough (the quota seems to be 2500 requests per day, 10 requests per second max) but after some requests I obtain this exception in Geocoder_Complete:

B4X:
<B4IExceptionWrapper: Error Domain=kCLErrorDomain Code=2 "(null)">

Then I continue to call the geocoder and after some seconds it starts to work again.

The Google Developer Console shows some graph of the request per second, but it seems to me they are only referred to the GoogleMap usage, not the geocoder.
Does the Ilocation library use the same API Key declared in the app ?
I suppose yes, but why I can't see in the graph the massive geocoder request that My app is generating ?
 

marcick

Well-Known Member
Licensed User
Longtime User
Oh ..
They say "in a typical situation, you should not send more than one geocoding request per minute." ......
How can I use the google API instead ? They have precise and documented rate limits.
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Ok
I have found here the code https://www.b4x.com/android/forum/threads/b4j-question-geocoder.62842/#post-396959

the structure is like this:

B4X:
Sub Geocode(Lat As Double, Lng As Double)
    ' meke the http request
End Sub
Sub JobDone (Job As HttpJob)
    ' here I have the result
end sub

Non the question is: how can I turn this into a function so that I can write this (from anywhere in my app) ?

B4X:
addr=GeoCode(45,8)

Does it require skill in creating libs ? (out of my range ...)
 
Last edited:
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
Understand, thanks.
But when I use the geocoding from several modules, do I have to duplicate the code ? I would like to write the code in one place and call it from anywhere.
But when I have the JobDone event how can I return to the point the geocoder has been called ?
 
Upvote 0
Top