我创建了API密钥,配额为<1k p /天,但仍然出现错误“无法加载搜索结果”
活动代码:
parseInt
片段所在的布局代码:
Places.initialize(this, key);
placesClient = Places.createClient(this);
final AutocompleteSupportFragment autocompleteSupportFragment =
(AutocompleteSupportFragment)
getSupportFragmentManager().findFragmentById(R.id.autocomplete_fragment);
autocompleteSupportFragment.setPlaceFields
(Arrays.asList(Place.Field.NAME));
autocompleteSupportFragment.setOnPlaceSelectedListener(new
PlaceSelectionListener() {
@Override
public void onPlaceSelected(@NonNull Place place) {
final String name = place.getName();
Log.d("lol", name);
}
@Override
public void onError(@NonNull Status status) {
}
});
我希望日志中有城市名称
答案 0 :(得分:0)
我通过在Google Cloud Console中启用计费帐户解决了我的问题。