I want to use Google Translate API (v2) in my android application.
What I did:
- created project in Google Developers Console
- set up billing for this project
generated 2 public api access keys for android applications:
a. First one that accepts request from any application
b. Second one that accepts requests from my application only
I tried to translate text from the application via https://www.googleapis.com/language/translate/v2?key=MY-KEY&target=de&q=Hello%20world
It works fine with the key from 3a) but does not work with the key from 3b). For 3b) server sends
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "ipRefererBlocked",
"message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.",
"extendedHelp": "https://console.developers.google.com"
}
],
"code": 403,
"message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed."
}
}
I guess this is because google server does not receive any info about my application with this request, so it cannot acquire key 3b). If so, how to send this request correctly? Or, alternatively, what I did wrong somewhere else?