How to specify language in Google Sign-In intent in Android?

39 views Asked by At

I am creating an app, in which user firstly specify in-app language and then is allowed do proceed to button from which is Google Sign-In intent launched. I was using this tutorial and it works perfectly link to tutorial, but there is no option to specify language.

I was trying to use

Locale locale = new Locale(languageShort);
Locale.setDefault(locale);

and

Resources resources = context.getResources();
Configuration configuration = resources.getConfiguration();
configuration.setLocale(new Locale(languageShort));
resources.updateConfiguration(configuration, resources.getDisplayMetrics());

and both of them and language of intent was still the same...

Google Sign-In intent window image

Is there any way to change language of this window programmatically in Java or Kotlin?

It would be perfect if there would be something like putExtra() method in intent with language option, but it seems Google Identity does not support it:

Intent signInIntent = mGoogleSignInClient.getSignInIntent();
signInIntent.putExtra("language", "de");  // Google Identity does not support this
startActivityForResult(signInIntent, RC_SIGN_IN);
0

There are 0 answers