To initialize the Google Translate API, it must be done in a thread. Most of the time it only takes 2 seconds. However, 1 out of every 5 times, it takes anywhere from 20 seconds to 3 minutes (Unacceptable).
AppCompatActivity where I Initialize Google Translate API
AsyncTask<Void, Void, Void> asyncTask = new AsyncTask<Void, Void, Void>() {
@Override
public void onPostExecute (Void aVoid) {
Log.i("APP", "finished initializing");
}
@Override
protected Void doInBackground(Void... voids) {
Log.i("APP", "started initializing");
translate2 = TranslateOptions.newBuilder().setApiKey(MY_API_KEY).build().getService();
return null;
}
};
asyncTask.execute();
Gradle
I also have the latest version in my gradle (module):
compile ('com.google.apis:google-api-services-translate:v2-rev49-1.22.0')
Note
It used to work instantly, this error is very recent. I'm not sure why this is occurring out of nowhere.