最近,我的一些用户开始报告搜索图标已从PlacePicker UI小部件中消失。我能够将问题隔离到更新到Google Play Services 9.0.83。有没有人找到一种解决方法来重新获得搜索图标?
更新:我还注意到,在更新到9.0.83后,PlacePicker.IntentBuilder类的 setLatLngBounds()方法不再正常运行。它将地图定位在非洲沿海的0纬度0长的地方。只要我不调用setLatLngBounds(),PlacePicker就会以我当前的位置为中心。
更新:我有个主意,但我需要每个人的帮助。根据此网站apkmirror.com的信息,基于CPU和屏幕DPI,有9.0.83的颠覆。在“应用程序管理器”中,选择Google Play服务,并且版本应该在版本旁边的括号中,我的 440-121911109,如果您遇到同样的问题,请在评论中发布。也许我们可以找到一个共同点。
更新至Google Play Services 9.0.83之前
更新至Google Play Services 9.0.83后
static final int PPR = 41;
private GoogleApiClient googleApiClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.place_picker_activity);
googleApiClient = new GoogleApiClient
.Builder(this)
.addApi(Places.GEO_DATA_API)
.addApi(Places.PLACE_DETECTION_API)
.enableAutoManage(this, this)
.build();
Button btnLaunch = (Button) findViewById(R.id.buttonLaunch);
btnLaunch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (googleApiClient.isConnected()) {
try {
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
startActivityForResult(builder.build(PlacePickerActivity.this), PPR);
} catch (GooglePlayServicesRepairableException e) {
e.printStackTrace();
} catch (GooglePlayServicesNotAvailableException e) {
e.printStackTrace();
}
} else {
Toast.makeText(getApplicationContext(),"Google api not connected yet", Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
protected void onStart() {
super.onStart();
googleApiClient.connect();
}
@Override
protected void onStop() {
super.onStop();
if (googleApiClient.isConnected()) {
googleApiClient.disconnect();
}
}
@Override
public void onConnected(Bundle connectionHint) { }
@Override
public void onConnectionFailed(ConnectionResult result) {
Toast.makeText(getApplicationContext(), "Connection failed: " + result.getErrorCode(), Toast.LENGTH_LONG).show();
}
@Override
public void onConnectionSuspended(int cause) {
Toast.makeText(getApplicationContext(), "Connection suspended",Toast.LENGTH_LONG).show();
googleApiClient.connect();
}
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == PPR) {
if (resultCode == RESULT_OK) {
Place place = PlacePicker.getPlace(this, data);
Toast.makeText(this, ""+place.getName(), Toast.LENGTH_LONG).show();
}
}
}
答案 0 :(得分:0)
这看起来可能与PlacePicker组件与设备配置不同步有关。您可以尝试的一件事是在Android拨号程序中force a config checkin on affected devices by dialing *#*#2432546#*#*。