Android Google Service Place选择器setLatLngBounds()不工作

Android Google Service Place选择器setLatLngBounds()不工作,android,google-maps,android-studio,Android,Google Maps,Android Studio,我正在我的应用程序中使用PlacePicker。突然间,它表现得很糟糕。当其启动时,指向(0.0,0.0)lat lng。 我不确定谷歌服务是否改变了什么。早些时候,它运行良好,因为从3天起它就不工作了 我做错什么了吗 这就是我发起活动的方式 private void launchPlacePicker(double latitude, double longitude) { try { showProgress(true); PlacePicker.In

我正在我的应用程序中使用PlacePicker。突然间,它表现得很糟糕。当其启动时,指向(0.0,0.0)lat lng。 我不确定谷歌服务是否改变了什么。早些时候,它运行良好,因为从3天起它就不工作了

我做错什么了吗

这就是我发起活动的方式

private void launchPlacePicker(double latitude, double longitude) {
    try {
        showProgress(true);
        PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();

        Log.d(TAG, " launchPlacePicker " + latitude + " " + longitude);

        builder.setLatLngBounds(MapUtils.getLatLngBounds(new LatLng((double) latitude, (double) longitude)));

        startActivityForResult(builder.build(this), PLACE_PICKER_REQUEST);
    } catch (GooglePlayServicesRepairableException e) {
        showProgress(false);
        Log.e(TAG, "GooglePlayServicesRepairableException", e);
    } catch (GooglePlayServicesNotAvailableException e) {
        showProgress(false);
        Log.e(TAG, "GooglePlayServicesNotAvailableException", e);
    }
}
这就是我创建LatLngBounds的方式

public static LatLngBounds getLatLngBounds(LatLng center) {
    double radius = 100;
    LatLng southwest = SphericalUtil.computeOffset(center, radius * Math.sqrt(2.0), 225);
    LatLng northeast = SphericalUtil.computeOffset(center, radius * Math.sqrt(2.0), 45);
    return new LatLngBounds(southwest, northeast);
}
我试着创建如下的LatLngBounds,仍然是相同的结果

public static LatLngBounds getLatLngBounds(LatLng center) {
    LatLngBounds.Builder builder = LatLngBounds.builder();
    builder.include(center);
    return builder.build();
}

有人能帮我一下吗?

不幸的是,你将不得不等待谷歌在未来发布的谷歌游戏服务中解决这个问题

您的代码没有任何问题,Google Play服务的最新更新导致Place Picker UI小部件出现一些严重问题。我首先注意到,setLatLngBounds()方法在Google Play Services 9.0.82中不再有效。在9.0.83中,搜索图标消失

请参阅我关于此问题的帖子:

请参见谷歌地图API缺陷和功能网站上的这些缺陷报告: ----- -----


您可以通过而不是调用setLatLngBounds()方法来解决这个问题。PlacePicker将默认为您的当前位置。我的应用程序失去了一些功能,但这总比让最终用户从大西洋回来时试着用手指捏和平移要好。对我来说,缺少搜索图标仍然是我的主要问题。

setLatLngBounds()问题就地选取器应该在当前发布的Google Play Services(6月26日)中修复。我知道这个问题很老,但我也有类似的问题,在启动时,就地选取器不会默认为我当前的L位置,它从先前选择的位置开始,我需要点击“我的位置”图标以将标记移动到我的位置。有没有办法在启动时默认将PlacePicker强制到我的当前位置?