【发布时间】:2015-08-22 14:37:39
【问题描述】:
我正在尝试从已知 placeID 位置(“ChIJqaUj8fBLzEwRZ5UY3sHGz90”)获取照片。
我正在使用下面的代码(来自谷歌指南)
PlacePhotoMetadataResult result = Places.GeoDataApi.getPlacePhotos(mGoogleApiClient, placeId).await();
if (result.getStatus().isSuccess()) {
PlacePhotoMetadataBuffer photoMetadataBuffer = result.getPhotoMetadata();
if (photoMetadataBuffer.getCount() > 0 && !isCancelled()) {
// Get the first bitmap and its attributions.
PlacePhotoMetadata photo = photoMetadataBuffer.get(0);
CharSequence attribution = photo.getAttributions();
// Load a scaled bitmap for this photo.
Bitmap image = photo.getScaledPhoto(mGoogleApiClient, mWidth, mHeight).await()
.getBitmap();
attributedPhoto = new AttributedPhoto(attribution, image);
}
// Release the PlacePhotoMetadataBuffer.
photoMetadataBuffer.release();
}
result.getStatus 返回成功,但 PhotoMetadataBuffer 返回空(photoMetadataBuffer.getCount = 0)。
有没有人用这个方法成功得到图片?
【问题讨论】:
标签: android google-places-api photo