How to set language restriction in com.google.android.libraries.places:places:

狂风中的少年 提交于 2019-12-11 08:08:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!