user2214110
user2214110

Reputation: 31

Official Google Translate API v2 (Android)

How I can use the Official Google Translate API v2 on Android? Please help! Any example?

I paid for the service and I tried with that Unofficial API and doesn't work. That Unofficial API have examples in Java. The Official API doesn't have examples in Java because uses RES (HTTP Requests) and returns JSON. It's that complicated?

Upvotes: 2

Views: 4403

Answers (2)

Jordi Gomis
Jordi Gomis

Reputation: 63

here there are a simple example that I used on an app:

private String translateText(String toTrasnlate){
TranslateOptions options = TranslateOptions.newBuilder()
    .setApiKey("XXXXXXXXXXXXXXXXXXXXX_XXXXXXXX")
    .build();
Translate translate = options.getService();
Translation translation = translate.translate(toTrasnlate, 
Translate.TranslateOption.targetLanguage("en"));
return translation.getTranslatedText();
}

And this link was useful for me: https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/translate/src/main/java/com/example/cloud/translate/samples/TranslateText.java

Upvotes: 0

st-taro
st-taro

Reputation: 19

If you mean to ask how you can gain access to the Google Translate API v2, it is a paid service and can be purchased here. Otherwise if you meant to ask how to use it, the examples are on the same website over in "Getting Started" section.

Though I think you may be looking for this.

Upvotes: 1

Related Questions