Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Places API always return error

I have integrated Google Places API in my android application. I have read the api documentation See Here.

I have activated Google Places Api for android and generated browser key and when i call api get error in response -

{"error_message" : "This API project is not authorized to use this API.Please ensure that this API is activated in the APIs Console: Learn more: https://code.google.com/apis/console",
  "html_attributions" : [],
  "results" : [],
  "status" : "REQUEST_DENIED"
}

I also try creating android key and it return -

{
 "error_message" : "This IP, site or mobile application is not authorized to use this API key.",
 "html_attributions" : [],
 "results" : [],
 "status" : "REQUEST_DENIED"
}

I am not getting what the problem in my code.

Any help is appreciated. Thanks in advance.

Check API Console - enter image description here

like image 561
Guess Avatar asked May 05 '15 04:05

Guess


People also ask

How can I get more than 20 results on Google Places API?

The documentation says that the Places API returns up to 20 results. It does not indicate that there is any way to change that limit. So, the short answer seems to be: You can't. Of course, you might be able to sort of fake it by doing queries for several locations, and then merging/de-duplicating the results.


1 Answers

I had the same problem. In my case the problem was that I tried to send request using simple HttpUrlconnection by this url:

 https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=62.25227243964484%2C59.12338379770518&radius=500&key=my_key

Where my_key was a key for Google Places API for Android, but when I switched to Google Places API Web Service, this works fine. It seems that for using key for Google Places API for Android you should follow this guide https://developers.google.com/places/android/

like image 199
Waran- Avatar answered Sep 17 '22 14:09

Waran-