问题
I'm setting up this new google places api --> com.google.android.libraries.places:places:1.1.0 but I'm unable to find to set the language for results provided by this api.
when I input some keywords it shows result in Local Language "Hindi"(Indian Language) only in few keywords it is doing this but in general it shows normal English results.
There is the following keyword on which it shows result in Hindi:-
Keyword: "Rohini Sector 11"
Output: 244, behind G3S CINEMA HALL, सेक्टर 11, रोहिणी, दिल्ली 110085, दिल्ली, India
FindAutocompletePredictionsRequest.
FindAutocompletePredictionsRequest request =
FindAutocompletePredictionsRequest.builder()
// Call either setLocationBias() OR setLocationRestriction().
//.setLocationBias(bounds)
.setCountry("IN")
.setTypeFilter(TypeFilter.REGIONS)
.setSessionToken(token)
.setQuery(constraint.toString())
.build();
Task<FindAutocompletePredictionsResponse> autocompletePredictions = placesClient.findAutocompletePredictions(request);
I expect the output of this api like:
Keyword: "Rohini Sector 11"
Output: 244, behind G3S CINEMA HALL, Sector 11, Rohini, Delhi 110085, Delhi, India
回答1:
It looks like this is not currently possible, but there are feature requests for this in Google's Issue Tracker which I recommend starring to increase visibility and subscribe to future notifications:
https://issuetracker.google.com/issues/35830937
https://issuetracker.google.com/issues/63829150
Hope this helps!
来源:https://stackoverflow.com/questions/58409098/how-to-set-language-restriction-in-com-google-android-libraries-placesplaces