获取当前位置时Google地址api会返回错误

时间:2016-08-26 05:35:12

标签: java android google-places-api

我正在使用google place API,在此期间,我从google place picker获取任何地方,但是从此处获取我当前的位置。

PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi.getCurrentPlace(mGoogleApiClient, null);
                result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
                    @Override
                    public void onResult(@NonNull PlaceLikelihoodBuffer  likelyPlaces) {
                        Log.e("result",""+likelyPlaces);
                        for (PlaceLikelihood placeLikelihood : likelyPlaces) {
                            Log.e("result", String.format("Place '%s' has likelihood: %g",
                                    placeLikelihood.getPlace().getName(),
                                    placeLikelihood.getLikelihood()));

                            Toast.makeText(MainActivity.this,"Place "+placeLikelihood.getPlace().getName()+" has likelihood "+placeLikelihood.getLikelihood()+"",Toast.LENGTH_LONG ).show();
                        }
                        likelyPlaces.release();
                    }
                });

PlaceLikelihoodBuffer返回statusCode错误:

PlaceLikelihoodBuffer{status=Status{statusCode=ERROR, resolution=null}, attributions=null}

所以我长期被困在这里,而且我没有找到任何与此相关的解决方案。

0 个答案:

没有答案