Create ImageGallery private images in S3 Client android

I am trying to create an imageGallery of my S3 Bucket in an android application. My images are private, so I will not have any specific links for each image.

For such private images, amazon has a link generator,

s3Client.generatePresignedUrl(Constants.S3_BUCKET_NAME, key, expiration);

It generates a URL that allows you to specify a validity period of 1 hour or 2 minutes.

Now for easy memory caching, etc. I can use volleyball or Picasso or many other such simple loading libraries.

However, there is this catch. I want to cache these images in memory. But I have a dynamic connection.

How can I get Picasso or any other library to use a dynamic link for caching?

According to my information, libraries use Url as a "key" for caching, is this a fix? if so, how can I save these images, so I can use these images later, even when I'm online, again, I have a dynamic link, so the URL will change every time, so maybe I need to save them using the key that I pass s3Client.

What's the solution.

+4
source share
1 answer

The latest version Picassouses network policy settings. Perhaps you need to set NetworkPolicy.OFFLINEfor the constructor Picasso.Request:

Picasso.with(this)
            .load(s3Url)
            .networkPolicy(NetworkPolicy.OFFLINE)
            .into(imageView);

, CacheControl Picasso OkHttpClient, , S3.

0

All Articles