Android – Google Places API Key for Android App

androidgoogle mapsgoogle-maps-api-3google-places-apigoogle-play-services

I have created an API Key (for Android apps) for my Android Application. It was required by google maps API. But now the same key won't work for Google Places API.

I also tried hitting the browser with the following URL:

https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJN1t_tDeuEmsRUsoyG83frY4&key=my_key

I get:

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

When I googled for an answer, I found this:

https://developers.google.com/places/training/autocomplete-android

What type of API key?

You'll need your own browser or server API key for the Google Places API before you can begin using the Place Autcomplete service. Note that an Android API key will not work for the Place Autocomplete service.

This got me confused as I do not have any URL for a web app, nor any server IP. Therefore I am confused on how to get either a Browser key or a Server key

Could anyone please help me in figuring out what sort of key is needed here? Also if I have to create a Browser key or a Server key, how can I do so?

Best Answer

see this doc to know how to obtain google places API key

Check out this tutorial for integrating Google places

Related Topic