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

24,422

Solution 1

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.

Solution 2

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.

Solution 3

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.

Solution 4

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

Share:
24,422
Mitja Rogl
Author by

Mitja Rogl

Updated on July 09, 2022

Comments

  • Mitja Rogl
    Mitja Rogl almost 2 years

    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
    Mitja Rogl almost 10 years
    So then one API key is in manifest and one is in the request URL?
  • Illegal Argument
    Illegal Argument almost 10 years
    for maps its in the meta of manifest for places it may be in the url or your own server not sure about places api though. For gcm it was in my server.
  • Abhinav Singh Maurya
    Abhinav Singh Maurya over 8 years
    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 you will be able to comment on any post. - From Review
  • Hari Enaganti
    Hari Enaganti over 8 years
    I am also faced same situation ,While you are checking for places through forming a Webservice url maps.googleapis.com/maps/api/place/nearbysearch/… .... like Please use webservice API Key for maps.
  • Kaveesh Kanwal
    Kaveesh Kanwal almost 8 years
    But the doc says use the api key?