Dan*_*oss 7 android google-places-api google-play-services gmsplacepicker
最近,我的一些用户开始报告搜索图标已从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();
}
}
}
Run Code Online (Sandbox Code Playgroud)
这看起来可能与 PlacePicker 组件与设备配置不同步有关。您可以尝试的一件事是通过在 Android 拨号器应用程序中拨打 *#*#2432546#*#* 来强制在受影响的设备上进行配置签入。
| 归档时间: |
|
| 查看次数: |
886 次 |
| 最近记录: |