最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Getting REQUEST_DENIED error in Android app with Geocoding API - Stack Overflow

programmeradmin0浏览0评论

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:

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

发布评论

评论列表(0)

  1. 暂无评论