最近我的一些用户报告说,在PlacePicker UI小部件中,搜索图标消失了。我能够确定这个问题是由于升级到Google Play Services 9.0.83引起的。有人找到解决办法让搜索图标重新出现了吗?
更新:我还注意到,在升级到9.0.83之后,PlacePicker.IntentBuilder类的setLatLngBounds()方法不再正常工作。它会将地图居中于非洲海岸外的0纬度和0经度位置。只要我不调用setLatLngBounds(),PlacePicker就会居中于我的当前位置。 更新:我有一个想法,但需要大家的帮助。根据这个网站apkmirror.com提供的信息,9.0.83版本基于CPU和屏幕DPI有不同的子版本。在应用程序管理器中,选择Google Play服务,子版本应该在版本旁边的括号中,我的是440-121911109,请在评论中发布你的版本,如果你遇到了相同的问题。也许我们可以找到一个共同点。 更新到Google Play服务9.0.83之前
更新到Google Play服务9.0.83之后
更新:我还注意到,在升级到9.0.83之后,PlacePicker.IntentBuilder类的setLatLngBounds()方法不再正常工作。它会将地图居中于非洲海岸外的0纬度和0经度位置。只要我不调用setLatLngBounds(),PlacePicker就会居中于我的当前位置。 更新:我有一个想法,但需要大家的帮助。根据这个网站apkmirror.com提供的信息,9.0.83版本基于CPU和屏幕DPI有不同的子版本。在应用程序管理器中,选择Google Play服务,子版本应该在版本旁边的括号中,我的是440-121911109,请在评论中发布你的版本,如果你遇到了相同的问题。也许我们可以找到一个共同点。 更新到Google Play服务9.0.83之前
![Before updating to Google Play Services 9.0.8](https://istack.dev59.com/PGvyQm.webp)
![After updating to Google Play Services 9.0.83](https://istack.dev59.com/UnIxEm.webp)
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();
}
}
}