【问题标题】:Android Place Picker (PlacePicker) no longer has Search icon after updating to Google Play Services 9.0.83Android Place Picker (PlacePicker) 更新到 Google Play Services 9.0.83 后不再有搜索图标
【发布时间】:2016-05-17 02:35:22
【问题描述】:

最近,我的一些用户开始报告说,搜索图标已从 PlacePicker UI 小部件中消失。我能够将问题隔离到更新到 Google Play 服务 9.0.83。有没有人找到解决方法来重新找回搜索图标?

更新:我还注意到 PlacePicker.IntentBuilder 类的 setLatLngBounds() 方法在更新到 9.0.83 后不再正常工作。它将地图的中心定位在非洲海岸外的海洋中 0 纬度、0 度长。只要我不调用 setLatLngBounds(),PlacePicker 就会以我当前的位置为中心。

更新:我有一个想法,但我需要大家的帮助。根据来自该网站apkmirror.com 的信息,有基于 CPU 和屏幕 DPI 的 9.0.83 的子版本。在应用程序管理器中,选择 Google Play Services,subversion 应该在版本旁边的括号中,我的是 440-121911109,如果您有同样的问题,请在 cmets 中发布您的。也许我们可以找到一个共同点。

更新到 Google Play 服务 9.0.83 之前

更新到 Google Play 服务 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();
        }
    }
}

【问题讨论】:

  • 您使用什么版本的 Google Play 服务编译您的应用程序?
  • @Daniel Nugent compile 'com.google.android.gms:play-services:8.4.0'
  • 这里有同样的问题。卸载更新后图标也丢失了...
  • 同样的问题。有人知道谷歌什么时候会更新和解决这个问题吗?

标签: android google-play-services google-places-api gmsplacepicker


【解决方案1】:

这看起来可能与 PlacePicker 组件与设备配置不同步有关。您可以尝试的一件事是在 Android 拨号器应用中发送 force a config checkin on affected devices by dialing *#*#2432546#*#*

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-22
    相关资源
    最近更新 更多