8

I have a problem with connection with Google maps API V2 and Android. I' ve enabled services:

  • Google Maps Android API v2
  • Places API

Also I've added sha1 fingerprint.

enter image description here

But I still get this message: This IP, site or mobile application is not authorized to use this API key

I'm calling service from Android. Do you know where might be the problem, cause I don't know where to search.

Mitja Rogl
  • 894
  • 9
  • 22
  • 39
  • 3
    I am facing the same issue. Did u fix this? – SKK Jul 25 '14 at 12:23
  • For android application you need to use a Browser key not the Android key. – Prakash Jun 05 '15 at 18:43
  • Possible duplicate of [This IP, site or mobile application is not authorized to use this API key](https://stackoverflow.com/q/21933247/608639) – jww Nov 11 '18 at 02:09

7 Answers7

9

You must be creating a browser key instead of an android key. I faced similar problem when I accidentely created an android key for Google Cloud Messaging instead of a server key. Please check which key is required for your purpose. For google maps v2 you need android key and for google places api you need a server key(searched google but not so sure on this one never used it). So basically you need two keys.

Update: You need server key for places api.

Illegal Argument
  • 10,090
  • 2
  • 44
  • 61
6

Refer this tutorial.

http://www.androidhive.info/2012/08/android-working-with-google-places-and-maps-tutorial/

Step 1- Go to code.google.com/apis/console/?noredirect

Step 2- Create a new project

Step 3- Go to services and choose Places API, turn it on. This will ask your organization name and url.Fill them and click Ok.

Step 4- Now go to API Access and there will be your API Key. You don't have to click on Create new key. This will be your browser apps key which you can use in your Android Apps.

This solution worked for me perfectly.

Ruchir
  • 1,086
  • 4
  • 24
  • 48
2

If generating an Android App, the "Server" IP address could be any IP of any phone on any network. What do I write in the "Accept requests from these server IP addresses" box in order to have any IP address accepted?

Edit - Apologies. Apparently just leave it blank...

Michael James
  • 492
  • 1
  • 6
  • 19
2

I just had this issue the other day, it is not actually an issue with this library.

First, make sure you're using a server API key, not an Android/iOS key (if you're doing mobile development). See this stackoverflow post: Google Places API request denied for Android autocomplete, even with the right api key . The TL;DR version of that link is that Google Places API doesn't support the Android/iOS key option, only the server option.

Second, and this goes without saying, make sure you're passing the key to the GooglePlaces instance.

Lastly, if you're restricting use of the API key by IP make sure your request is coming from an allowed address.

Community
  • 1
  • 1
Hari Enaganti
  • 359
  • 1
  • 4
  • 12
0

You don't need to create a key for using Google place API, instead just use "Key for browser apps (with referers)". But if you want to use Google Map API, you need to generate a Android Key, and you could find instruction here :https://developers.google.com/maps/documentation/android/start.

Good luck.

Sam003
  • 540
  • 6
  • 17
0

I got this problem too. but I SOLVED this issue only using something tricky. Go to your google console and create new key which is browser key, then let the column empty and save. you can use the key that has been created in you mobile apps now. GOOD LUCK! *Unfortunately I can't post an image to this answer

-3

Change your API key, you may use Android key in the URL. For to specify Key in the URL you need to get WEBSERVICE key.

Stefan
  • 5,203
  • 8
  • 27
  • 51
Hari Enaganti
  • 359
  • 1
  • 4
  • 12
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). - [From Review](/review/low-quality-posts/10646957) – Abhinav Singh Maurya Dec 22 '15 at 06:18
  • I am also faced same situation ,While you are checking for places through forming a Webservice url https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=&radius .... like Please use webservice API Key for maps. – Hari Enaganti Dec 22 '15 at 06:43