Mitja Rogl
Mitja Rogl

Reputation: 884

This IP, site or mobile application is not authorized to use this API key - Android

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

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.

Upvotes: 8

Views: 25000

Answers (7)

Hari Enaganti
Hari Enaganti

Reputation: 359

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.

Upvotes: -3

Hari Enaganti
Hari Enaganti

Reputation: 359

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.

Upvotes: 2

Rezpa Aditya
Rezpa Aditya

Reputation: 11

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

Upvotes: 0

Sam003
Sam003

Reputation: 550

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.

Upvotes: 0

Ruchir
Ruchir

Reputation: 1122

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.

Upvotes: 6

Michael James
Michael James

Reputation: 616

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...

Upvotes: 2

Illegal Argument
Illegal Argument

Reputation: 10358

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.

Upvotes: 9

Related Questions