问题
Is it possible to filter the locations google placepicker displays for lets say only supermarkets? Otherwise, how would i best go about creating a view like this?
mGoogleApiClient = new GoogleApiClient
.Builder(this)
.addApi(Places.GEO_DATA_API)
.addApi(Places.PLACE_DETECTION_API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
int PLACE_PICKER_REQUEST = 1;
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
try {
Context context = getApplicationContext();
startActivityForResult(builder.build(context), PLACE_PICKER_REQUEST);
}
catch (Exception e) {
}
回答1:
This feature is not currently available. You may follow these two open issues for updates:
- Issue 8484: Filter Place Picker by PlaceType
- Issue 8565: PlacePicker Customization - Add Place Type Filter to Intent Builder
回答2:
As far as I know, you can't. I tried extend the PlacePicker class, nothing I can override. Place Picker API looks tentative, hope Google will add this feature in the future.
回答3:
You will need to add a place type in your place search, grocery_or_supermarket is one of them.
Source: https://developers.google.com/places/supported_types
来源:https://stackoverflow.com/questions/30780287/is-it-possible-to-filter-google-place-picker