我試圖搜索Latlng
使用google place
api的地方(如餐館或酒店)。有沒有可能改變Places.PlaceDetectionApi getCurrentPlace(mGoogleApiClient, pf);
的結果並設置其他座標。我的代碼是:設置當前的谷歌地點API位置
mGoogleApiClient = new GoogleApiClient
.Builder(this)
.addApi(Places.GEO_DATA_API)
.addApi(Places.PLACE_DETECTION_API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
ArrayList<String> restrictToRestaurants = new ArrayList<>();
restrictToRestaurants.add(Integer.toString(Place.TYPE_RESTAURANT));
PlaceFilter pf;
pf = new PlaceFilter(false, restrictToRestaurants);
PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi
.getCurrentPlace(mGoogleApiClient, pf);
result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
@Override
public void onResult(PlaceLikelihoodBuffer likelyPlaces) {
final CharSequence thirdPartyAttributions = likelyPlaces.getAttributions();
for (PlaceLikelihood placeLikelihood : likelyPlaces) {
Log.i("tag", String.format("Place '%s' has likelihood: %g",
placeLikelihood.getPlace().getName(),
placeLikelihood.getLikelihood()));
}
likelyPlaces.release();
}
});
所以我有一個變量Latlng
,我想搜索的地方几乎是協調。提前致謝。
在閱讀了更多谷歌地方API後,我明白,沒有辦法做到這一點(其唯一用於查找設備位置附近的地方:()......作爲一個建議,也許Google的人可以開發一個功能,給一個位置檢索幾乎那個位置的地方:)(對我的英語感到抱歉,是如此糟糕) – denials