Search code examples
androidgoogle-api-client

GoogleApiClient duplicate country value in Database


If I select the same location on a smartphone in GoogleApiClient with English language and other phone with Romanian/Russian(other language) I had a problem because the country is the same but it is wrote different, what can I do with this?


Solution

  • You can localize your activity in English and GoogleApiClient will work in this activity only in English

    super.onCreate(savedInstanceState);
    String languageToLoad  = "en"; // your language
    Locale locale = new Locale(languageToLoad);
    Locale.setDefault(locale);
    Configuration config = new Configuration();
    config.locale = locale;
    getBaseContext().getResources().updateConfiguration(config,
    getBaseContext().getResources().getDisplayMetrics());
    setContentView(R.layout.activity_search); //initialize google api