Aristide13
Aristide13

Reputation: 242

How to get thumbnails with Box android-content-sdk (notV2)

There is a way to get the thumbnails with new Box android-content-sdk? I don't see anything in the doc and methods: https://github.com/box/box-android-sdk

Upvotes: 1

Views: 169

Answers (1)

Aristide13
Aristide13

Reputation: 242

There are two methods that return a request:

/**
     * Gets a request that downloads a thumbnail to a target file
     *
     * @param target    target file to download thumbnail to
     * @param fileId    id of file to download the thumbnail of
     * @return  request to download a thumbnail to a target file
     * @throws IOException
     */
    public BoxRequestsFile.DownloadThumbnail getDownloadThumbnailRequest(File target, String fileId) throws IOException{
        if (!target.exists()){
            throw new FileNotFoundException();
        }
        BoxRequestsFile.DownloadThumbnail request = new BoxRequestsFile.DownloadThumbnail(target, getThumbnailFileDownloadUrl(fileId),mSession);
        return request;
    }

    /**
     * Gets a request that downloads the given file thumbnail to the provided outputStream. Developer is responsible for closing the outputStream provided.
     *
     * @param outputStream outputStream to write file contents to.
     * @param fileId the file id to download.
     * @return  request to download a file thumbnail
     */
    public BoxRequestsFile.DownloadThumbnail getDownloadThumbnailRequest(OutputStream outputStream, String fileId) {
        BoxRequestsFile.DownloadThumbnail request = new BoxRequestsFile.DownloadThumbnail(outputStream, getThumbnailFileDownloadUrl(fileId),mSession);
        return request;
    }

Upvotes: 0

Related Questions