增加getCurrentPlace的范围 [英] Increase the range of getCurrentPlace
问题描述
我与谷歌的Android API的地方玩,我试图用这个样本我旁边检索位置:
I'm playing with Google Places API for Android, i tried to retrieve location next to me with this sample :
PendingResult<PlaceLikelihoodBuffer> result =
Places.PlaceDetectionApi.getCurrentPlace(mGoogleApiClient, null);
result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
@Override
public void onResult(PlaceLikelihoodBuffer likelyPlaces) {
Log.d("Hello", "Got results: " + likelyPlaces.getCount() + " place found.");
for (PlaceLikelihood placeLikelihood : likelyPlaces) {
Log.i("Hello", String.format("Place '%s' has likelihood: %g",
placeLikelihood.getPlace().getName(),
placeLikelihood.getLikelihood()));
}
likelyPlaces.release();
}
});
问题是,它返回真我旁边的唯一的地方,有没有增加这个函数返回的地方范围的方法是什么?
The problem is that it returns only places really next to me, is there a way to increase the range of the places returned by this function ?
推荐答案
呼叫背后的想法是让该设备目前位于的地方。它返回一个列表的唯一原因是因为它不一定能肯定地告诉的地方列出哪些是你目前。它并不意味着被用于在更广泛的意义上看到附近的地点。
The idea behind the call is to get the place that the device is currently located at. The only reason it returns a list is because it can't necessarily tell for sure which of the places listed you are currently at. It's not meant to be used for seeing nearby places in a broader sense.
如果你想看到的就是你身边,而不是你在精确到位,API并包括一个方便的UI组件。这就是所谓的 PlacePicker 。
If you want to see what is around you, rather than the exact place you are at, the API does include a handy UI component for that. It is called the PlacePicker.
这篇关于增加getCurrentPlace的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!