Skip to content

Translate translate = TranslateOptions.newBuilder().setApiKey(MY_API_KEY).build().getService(); Sometimes Takes Very Long time #603

Description

@grantespo

In my Main Activity, I initialize the Translate variable. If you look at the logs: I track when the initialization starts and when it finishes. Most of the time it initializes quick. But 1/5 times it takes up to 30 seconds to 3 minutes (UNACCEPTABLE).

    AsyncTask<Void, Void, Void> asyncTask = new AsyncTask<Void, Void, Void>() {

        @Override
        public void onPostExecute (Void aVoid) {

            Log.i("APP", "finished");

        }

        @Override
        protected Void doInBackground(Void... voids) {
            Log.i("APP", "start");
          Translate  translate = TranslateOptions.newBuilder().setApiKey("XXXXX-ZZZZZ").build().getService();
            return null;
        }

    };
    asyncTask.execute();

I also have the latest versions in gradle:

   compile ('com.google.cloud:google-cloud-translate:0.11.0-alpha')
  compile ('com.google.apis:google-api-services-translate:v2-rev49-1.22.0')

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions