Reputation: 1
I’m encountering an issue when trying to use the Google Geocoding API in my Android app. When I make a request, I get the following response:
{
"error_message": "This IP, site or mobile application is not authorized to use this API key. Request received from IP address XXXX, with empty referer",
"results": [],
"status": "REQUEST_DENIED"
}
What I’ve done so far:
API Key Setup:
I created an API key in the Google Cloud Console. I restricted the key to Android apps by specifying the package name and SHA-1 fingerprint for my app. Geocoding API Enabled:
I’ve enabled the Geocoding API in the Google Cloud Console.
API Key Restrictions:
I did not set any IP restrictions because I’m testing it on an Android app. I have package name and SHA-1 fingerprint correctly set for the app. Testing the API Key:
I tested the API directly in Postman and got the same REQUEST_DENIED error with a message indicating that the IP or mobile app is not authorized.
What I need help with:
Why am I getting the REQUEST_DENIED error for an Android app, even after setting the package name and SHA-1 fingerprint? Is there anything I might be missing in the API key setup or Android configuration? Should I remove IP restrictions even if I’m testing on Android? Are there any additional settings or troubleshooting steps I should take?
Here’s the request I’m making:
https://maps.googleapis.com/maps/api/geocode/json?latlng=37.4236,-122.0838&key=XXXXX
I suspect this issue is related to HTTPS. Could you recommend the correct way to implement the Geocoding API in an Android Java app?
Thanks in advance for your help!
Upvotes: 0
Views: 37