gpt4 book ai didi

android - Google Places Android 显示错误 "place fields must not be empty"?

转载 作者:行者123 更新时间:2023-12-02 13:40:56 34 4
gpt4 key购买 nike

当我单击 Places Auto 完成 fragment 搜索框时,
我收到以下错误

 place fields must not be empty (9012) 
我已经迁移到新的地方 SDK 。还检查了我的 Google Billing 和 Maps API。一切都是正确的
我的代码
Places.initialize(getApplicationContext(),getResources().getString(R.string.google_api_key));

placesClient = Places.createClient(this);

AutocompleteSupportFragment placesfragment = (AutocompleteSupportFragment) getSupportFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);


placesfragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {

@Override
public void onPlaceSelected(@NonNull Place place) {
LatLng ll = place.getLatLng();

mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(ll, 14));

if (manmarker != null) manmarker.remove();
manmarker = mMap.addMarker(new MarkerOptions().position(ll).title("Manually Selected Location"));
manapprox = getAddressFromLatLAng(ll);
manualaddr.setText(manapprox);
manlatlng = ll;
}

@Override
public void onError(Status status) { // Handle the error
Toast.makeText(MapsActivity.this, "Something went wrong! please try again "+status.getStatusCode() + " " + status.getStatusMessage() + Places.isInitialized(), Toast.LENGTH_SHORT).show();
}
});
请帮我解决这个问题

最佳答案

尝试使用 setPlaceFields 指定要返回的地点数据的类型:

placesfragment.setPlaceFields(listOf(Place.Field.ID, Place.Field.NAME));
引用 here .

关于android - Google Places Android 显示错误 "place fields must not be empty"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63539509/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com