Android Question Google Places

Jorge M A

Well-Known Member
Licensed User
Longtime User
B4X:
Wait For(PlaceToLatLon("Israel Yodfat")) Complete (ll() As Double)

"Israel Yodfat" is the query parameter.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
B4X:
Wait For(PlaceToLatLon("Israel Yodfat")) Complete (ll() As Double)

"Israel Yodfat" is the query parameter.

So.. i have to implement that Sub, with the query parameter ,and it gives me back the Longitude and Latitude right? (I understand like this).

The thing i wish to do is something like:

- Query Parameter: Starbucks (ex)
- Result: A list of Near places named "Starbucks" like Google Maps.

So.. i can get the image, the name, ecc ecc

Because i saw on the info page of GooglePlaces that i can use filters, and many other things, but i didn't understand how to use it, and i wished that somebondy already used it , and can give me some tips.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
Mmm I tried to find something, but I didn’t ..
may I can take another look

I’m looking for it on the forum , but meanwhile ....

2E9E0446-D7AC-4A09-ABE5-EA50BA1FE90F.jpeg

This is what I would achieve (using Googles PLACES API )
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
Google Places autocomplete API is described here: https://developers.google.com/places/web-service/autocomplete

The custom view (https://www.b4x.com/android/forum/t...google-place-autocomplete-view.81976/#content) calls this API. You need to go over Google documentation and see whether it can return the results that you are interested in.

Yeah, i already downloaded that file.. but when i run that code and i wrote something in the searchbar nothing happend (i created the Google Places API key and i put it in the code)

Edit:
I took a look at the class code, and i think i spotted where i can modify to add parameters and how (reading what google say abouth html request). But the problem still the same, the file i downloaded doesn't gives errors, but doesn't give result as in the image too.. what could be the problem?

eee.jpg
 
Last edited:
Upvote 0

Jorge M A

Well-Known Member
Licensed User
Longtime User
Surely your problem is with your Google Account Apis and/or Credentials an how you configured it.

Try put this in your browser, replacing your key:

B4X:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=London&key=[YOUR_HIDDEN_KEY_HERE]

Is possible that you see a message similar to this:

B4X:
{
   "error_message" : "You have exceeded your daily request quota for this API. If you did not set a custom daily request quota, verify your project has an active billing account: http://g.co/dev/maps-no-account",
   "predictions" : [],
   "status" : "OVER_QUERY_LIMIT"
}
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
Surely your problem is with your Google Account Apis and/or Credentials an how you configured it.

Try put this in your browser, replacing your key:

B4X:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=London&key=[YOUR_HIDDEN_KEY_HERE]

Is possible that you see a message similar to this:

B4X:
{
   "error_message" : "You have exceeded your daily request quota for this API. If you did not set a custom daily request quota, verify your project has an active billing account: http://g.co/dev/maps-no-account",
   "predictions" : [],
   "status" : "OVER_QUERY_LIMIT"
}


Yes i get this D:
There is a usage limit, after that it will won't work?
What i could do?
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
Please read the recommendations carefully and in detail for future occasions.
There you will find the answers related to Google services.

View attachment 80471


After reserching problems, i found this (the links for quotas in the documentations doesn't work properly, so i had to find another way to see this information)
Annotazione 2019-05-17 095411.jpg

1 Request per day...

I can't add nothing.. it say that i have to enable billing for this project
 
Upvote 0

Jorge M A

Well-Known Member
Licensed User
Longtime User
By the mail I received previously from the post that is no longer here:

i'm trying to learn something new to me.. don't be aggressive

It was never my intention to be aggressive. Just stating that it is very important to spend time studying, especially the experts' recommendations, and all related forum topics. That's how I've learned from scratch every element to use in Android.

On the other hand, also know how to distinguish when it comes to an issue of B4A or third parties, in this case Google.
Google has greatly changed its policies and modes of operation in recent times, and so the example codes generously made available to us by forum members may not currently work as they are.
There's the opportunity area to update.

HOW it's possibile that i have pass 100 request per second

This refers to the fact that there are multiple users using the application, who can concurrently use the same API.

it say that i have to enable billing for this project

Yeah, that's how this works NOW with Google. :(


so i had to find another way to see this information

Good job! ;)
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
By the mail I received previously from the post that is no longer here:



It was never my intention to be aggressive. Just stating that it is very important to spend time studying, especially the experts' recommendations, and all related forum topics. That's how I've learned from scratch every element to use in Android.

On the other hand, also know how to distinguish when it comes to an issue of B4A or third parties, in this case Google.
Google has greatly changed its policies and modes of operation in recent times, and so the example codes generously made available to us by forum members may not currently work as they are.
There's the opportunity area to update.



This refers to the fact that there are multiple users using the application, who can concurrently use the same API.



Yeah, that's how this works NOW with Google. :(




Good job! ;)
By the mail I received previously from the post that is no longer here:



It was never my intention to be aggressive. Just stating that it is very important to spend time studying, especially the experts' recommendations, and all related forum topics. That's how I've learned from scratch every element to use in Android.

On the other hand, also know how to distinguish when it comes to an issue of B4A or third parties, in this case Google.
Google has greatly changed its policies and modes of operation in recent times, and so the example codes generously made available to us by forum members may not currently work as they are.
There's the opportunity area to update.



This refers to the fact that there are multiple users using the application, who can concurrently use the same API.



Yeah, that's how this works NOW with Google. :(




Good job! ;)


Ok thanks. I saw that there is a free plan, maybe i can try to get funcitoning that and then try again.., because if the api didn't work i can't test my app

(I'm the only user to use that app...)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I'm the only user to use that app...
I suggest to add a billing to your account.
With billingaccount you can create a new Apikey and restrict it to your app.
You´ll get the Free Requests for your Apikey. If you stay in they limit then nothing is billed.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
OK, i done it.
I add a biling to my account so i UNlocked the limitation of the API.
Then, to Find the the businesses as i want, i modified the Job in the Erel's examples in to this

B4X:
        j.Download2("https://maps.googleapis.com/maps/api/place/autocomplete/json", _
            Array As String("input", New, "type", "establishment", "location", "45.156389,10.791440","radius",500, "key", Main.GoogleApiKey))

and it works very well now.
Thanks you all
 
Upvote 0
Top