I am using Google Places API for Android and am trying to limit the results to only show Restaurants. I have included a PlaceFilter and seems to be correct but doesn't seem to be applying the filter and giving other results aside from Restaurants. See code:
ArrayList<String> restrictToRestaurants = new ArrayList<>();
restrictToRestaurants.add(Integer.toString(Place.TYPE_RESTAURANT));
PlaceFilter pf;
pf = new PlaceFilter(false, restrictToRestaurants);
PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi.getCurrentPlace(mGoogleApiClient, pf);
result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
@Override
public void onResult(PlaceLikelihoodBuffer likelyPlaces) {
for (PlaceLikelihood placeLikelihood : likelyPlaces) {
placeLikelihood.getPlace().getPlaceTypes();
Log.i(TAG, String.format("Place '%s' with " + "likelihood: %g", placeLikelihood.getPlace().getName(), placeLikelihood.getLikelihood()));
}
likelyPlaces.release();
}
});
Anyone have any ideas how to apply the PlaceFilter?