简体   繁体   中英

How to add more than two TypeFilter to FindAutocompletePredictionsRequest?

I'm migrating to new google places sdk client and I want to set more than 2 filter to FindAutocompletePredictionsRequest but I can not find the solution

var autoCompleteRequest = FindAutocompletePredictionsRequest.builder().setLocationBias(
            bounds).setCountry("TR").setQuery(query).setSessionToken(
            AutocompleteSessionToken.newInstance()).setTypeFilter(ADDRESS).build()

As you can see I can only set one filter also I want to set ADDRESS and ESTABLISHMENT together, I tried to set list of filter but doesn't work

sdk version

implementation 'com.google.android.libraries.places:places:1.1.0'

You can just remove setTypeFilter and by default it works with both.

 val request = FindAutocompletePredictionsRequest.builder()
        .setCountry(country)
        .setSessionToken(token)
        .setQuery(constraint.toString())
        .build()

您可以使用如下的二进制掩码:

.setTypeFilter(TYPE_FILTER_CITIES|TYPE_FILTER_ADDRESS)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM