Skip to content

Commit 532848e

Browse files
committed
Merge branch 'fix/place-types-address-java-demo' into main, resolving version catalog conflict
1 parent 871c70b commit 532848e

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

demo-java/src/main/java/com/example/placesdemo/AutocompleteAddressActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ private void startAutocompleteIntent() {
158158
// Build the autocomplete intent with field, country, and type filters applied
159159
Intent intent = new Autocomplete.IntentBuilder(AutocompleteActivityMode.OVERLAY, fields)
160160
.setCountries(List.of("US"))
161-
.setTypesFilter(List.of("establishment"))
161+
// IMPORTANT: the widget uses the legacy api
162+
.setTypesFilter(List.of(PlaceTypes.ADDRESS))
162163
.build(this);
163164
startAutocomplete.launch(intent);
164165
}

demo-java/src/main/java/com/example/placesdemo/PlacesDemoApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ public void onCreate() {
3333
return;
3434
}
3535

36-
Places.initialize(getApplicationContext(), apiKey);
36+
Places.initializeWithNewPlacesApiEnabled(getApplicationContext(), apiKey);
3737
}
3838
}

demo-java/src/main/java/com/example/placesdemo/programmatic_autocomplete/ProgrammaticAutocompleteToolbarActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ private void getPlacePredictions(String query) {
177177
.setLocationBias(bias)
178178
.setQuery(query)
179179
.setCountries(List.of("US"))
180-
.setTypesFilter(List.of(PlaceTypes.ESTABLISHMENT))
180+
.setTypesFilter(List.of(PlaceTypes.STREET_ADDRESS))
181181
.build();
182182

183183
// Perform autocomplete predictions request

0 commit comments

Comments
 (0)