I am trying to create an imageGallery of my S3 Bucket in my android application. My images are private so i won't be having any specific link for each image.
For Such private images , amazon has a link generator,
s3Client.generatePresignedUrl(Constants.S3_BUCKET_NAME, key, expiration);
It generates a URL with let's say 1 hour or 2 min expiration set by us.
Now for easy memory caching and stuff, i can either use volley or Picasso or many other such easy loading libraries.
However there is this catch. I want to cache these images in memory. But all i have is dynamic link.
How can i make Picasso or any other library use dynamic link to cache?
As per my information, the libraries use Url as "key" to cache, is that correcT? if so how can i save these images so i can use these images later even when i am offline, again, i have dynamic link so url will be changing every instant so maybe i need to save them with the Key i am passing to s3Client.
What is the solution.
Picasso version adopts setting network policies. Probably, you need to set
NetworkPolicy.OFFLINE for the
Picasso.with(this) .load(s3Url) .networkPolicy(NetworkPolicy.OFFLINE) .into(imageView);
Regarding the caching, you might want to set expiration time to
CacheControl of the Picasso
OkHttpClient, to be same as the S3 links.