Android Place Picker (PlacePicker) no longer has Search icon after updating to Google Play Services 9.0.83

两盒软妹~` 提交于 2019-11-27 14:09:40

问题


Very recently some of my users began reporting that the search icon had disappeared from the PlacePicker UI widget. I was able to isolate the issue to updating to Google Play Services 9.0.83. Has anybody found a workaround to get the search icon back again?

Update: I also noticed that the setLatLngBounds() method of the PlacePicker.IntentBuilder class no longer functions properly after updating to 9.0.83. It centers the map at 0 lat, 0 long out in the Ocean off the coast of Africa. As long as I do not invoke setLatLngBounds() the PlacePicker will center in on my current location.

Update: I have an idea, but I need everyone's help though. Based on information from this website apkmirror.com there are subversions of 9.0.83 based on the CPU and screen DPI. In the Application Manager, select Google Play Services and the subversion should be in parenthesis next to the version, mine is 440-121911109, please post yours in the comments if you are having the same issue. Maybe we can find a common denominator.

Before updating to Google Play Services 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();
        }
    }
}

回答1:


This looks like it might be related to the PlacePicker component being out of sync with the device config. One thing you can try is to force a config checkin on affected devices by dialing *#*#2432546#*#* in the Android dialer app.



来源:https://stackoverflow.com/questions/37266209/android-place-picker-placepicker-no-longer-has-search-icon-after-updating-to-g

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!