Setuping Google Cloud Platform. Want to use it Translator API. Stopes on the step of connecting App. There's a img to my step where im stocked
I have made environment variable on my Windows 10.
After that there's a piece of code
// If you don't specify credentials when constructing the client, the
// client library will look for credentials in the environment.
Storage storage = StorageOptions.getDefaultInstance().getService();
Page<Bucket> buckets = storage.list();
for (Bucket bucket : buckets.iterateAll()) {
// do something with the info
}
But don't understand what i should do with that. And what is my next step. And how I can attach Google Cloud API to my app. Is it the similar as just add library?
There's a link for guide https://cloud.google.com/docs/authentication/getting-started#auth-cloud-implicit-java
Did some one see step-by-step guide for auth in google cloud platform for android?
There is tutorial using Firebase Cloud Function for backend here . You just need to create an Android Client that insert into real time database.
Or if you want to call url api directly from android client, you need an api key which can be obtained in https://console.cloud.google.com/apis/credentials
https://www.googleapis.com/language/translate/v2?key=${apiKey}&source=en&target=${lang}&q=${text}
For calling api url in Android, you can use Retrofit2
or FastAndroidNetworking
library. But it will not secure, because you need to put your api key in client source code
The easiest way using Translate API is sending with HTTP requests. I think you should see REST API references and with a simple POST request by your API key you will figure out.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.