我在一个片段中使用google Maps,在它上面我使用PlaceAutoComplete片段。我面临的问题是,当我单击PlaceAutoComplete小部件时,它向我显示错误。
代码:
placeAutoComplete.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
Log.d("Maps", "Place selected: " + place.getName());
addMarker(place);
}
@Override
public void onError(Status status) {
Toast.makeText(getContext(),"Erro",Toast.LENGTH_SHORT).show();
Log.d("Maps", "An error occurred: " + status);
}
});
错误:
Status{statusCode=ERROR, resolution=null}
新错误:
{"errors":[{"domain":"global","reason":"forbidden","message":"Requests
to this API placesandroid method places.
PlacesService.AutocompleteWidget are blocked."}],"code":403}P
答案 0 :(得分:0)
在Google Developers Console(https://console.developers.google.com/)中启用Places API。