更新到Google Play Services 9.0.83后,Android Place Picker(PlacePicker)不再具有搜索图标。

7
最近我的一些用户报告说,在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之前
Before updating to Google Play Services 9.0.8 更新到Google Play服务9.0.83之后
After updating to 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();
        }
    }
}

您使用哪个版本的 Google Play 服务来编译您的应用程序? - Daniel Nugent
@Daniel Nugent 编译 'com.google.android.gms:play-services:8.4.0' - Dan Ross
1
我也遇到同样的问题。在卸载更新后,图标也丢失了... - roNn23
严重问题:https://dev59.com/b1oU5IYBdhLWcg3wlHwg - Sharanabasu Angadi
同样的问题。有人知道Google什么时候会更新和修复这个问题吗? - zek54
1个回答

0

这似乎与PlacePicker组件与设备配置不同步有关。您可以尝试的一件事是在Android拨号应用程序中拨打*#*#2432546#*#*来强制检查受影响设备上的配置


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接