I'm having problems with Android Google Places API - autocomplete feature. I use the same key that I used for Android Google Maps API but it is not open place fragment. Its only show Maps but when open a Place Autocomplete Fragment but its open and automatically close and show PLACES_API_ACCESS_NOT_CONFIGURED error. Please help me out to this issue and show the right to handle the issue. Here My Manifest XML:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyARQ78yaNEJH12aJLM1Y-112WY12p95ZOEGI"/>
And Here My Code for open Place AutocolmpleteFragment:
try {
Intent intent =
new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN)
.build(getActivity());
startActivityForResult(intent, 1);
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
// TODO: Handle the error.
}
And Here My code for getting a place response:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1) {
if (resultCode ==RESULT_OK) {
Place place = PlaceAutocomplete.getPlace(getActivity(), data);
onPlaceSelected(place,1);
bar.setVisibility(View.GONE);
autoCompleteTextViewPickup.setFocusable(true);
} else if (resultCode == PlaceAutocomplete.RESULT_ERROR) {
Status status = PlaceAutocomplete.getStatus(getActivity(), data);
this.onError(status,1);
bar.setVisibility(View.GONE);
autoCompleteTextViewPickup.setFocusable(true);
}
}