0
private void getLocation()throws SecurityException {
Log.e("TAG","Entered Get Location");
PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi.getCurrentPlace(mGoogleApiClient, null);
if(mGoogleApiClient!=null)
{
Log.e("TAG","Client Not Null "+mGoogleApiClient.toString());
}
result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
@Override
public void onResult(PlaceLikelihoodBuffer likelyPlaces) {
Log.e("TAG","Result " +likelyPlaces.getCount());
for (PlaceLikelihood placeLikelihood : likelyPlaces) {
Log.e("PLACES ",placeLikelihood.getPlace().getName().toString());
tvLikelyPlaces.append(String.format("Place '%s' with " +
"likelihood: %g",
placeLikelihood.getPlace().getName(),
placeLikelihood.getLikelihood()) + "\n");
}
likelyPlaces.release();
}
});
}
我试图登录likelyplaces,它显示了空,我已经尝试了物理设备上测试。我没有收到任何其他错误,Places.PlaceDetectionApi.getCurrentPlace给出空的结果和空likelyplaces
我确信我的API设置可以成功连接到Google客户端API,但似乎Android的Google Places API有一些问题。 我已经提到ACCESS_FINE_LOCATION,互联网和READ_GSERVICES许可
你有位置的权限 –
是FINE_LOCATION – rishi