1

We are using the Google Photos API java client on Android to retrieve some of the user's photo with this code:

try(PhotosLibraryClient photosLibraryClient = PhotosLibraryClient.initialize(settings)) {
    InternalPhotosLibraryClient.SearchMediaItemsPagedResponse libraryResponse = photosLibraryClient.searchMediaItems(filters);
    Iterable<InternalPhotosLibraryClient.SearchMediaItemsPage> listMediaItemsPage = libraryResponse.iteratePages();

    for (InternalPhotosLibraryClient.SearchMediaItemsPage mediaItemsPage : listMediaItemsPage) {
    /* ... */
    }
}

Our problem is that the mediaItemsPage only retrieve up to 25 mediaItem by default. According to the Google Photos API it's possible to move that number up to 100 by setting the "pageSize" parameter. However when using the Java client we cannot find how to correctly set this parameter.

There is a libraryResponse.iterateFixedSizeCollections(collectionSize); but looking at the method's doc it says:

it is an error to call this method if the optional parameter 'page_size' has not been * set in the original API call. It is also an error if the collectionSize parameter is less than * the page_size.

What is the "original API call"? What are the steps required in order to set pageSize correctly?

4

0 回答 0