I am passing a URL to fetch image from AMazon S3 in a mobile app.
Is there a way to cache all these images(coming from the url) for a certain amount of time?
Hello, @Amol Rane To cache your images you can use a client variable, to hold your image for a certain amount of time.
Also, if you have more problems, if you didn't see them until now you can look for other forums' comments here:
https://www.outsystems.com/forums/discussion/68538/external-image-isnt-caching/
https://www.outsystems.com/forums/discussion/59653/image-using-external-url-not-loaded-in-mobile-application/
Also the course about client variables and how to use them:
https://www.outsystems.com/training/lesson/2037/client-variables
Hope this helps!
Cheers,
Márcio Carvalho
Hi @Amol Rane
To cache an image on mobile I will suggest creating a local entity where you can store the image, and each time you logout or the app times out the entity will be cleaned.
Regards
Gonçalo Almeida
I am currently using local storage, but the problem is that there are multiple images(something like Netflix), and all images are not getting fetched at once. Multiple server calls have to be made to the server to get one image(From s3), hence takes a lot of time to load. I tried doing this asynchronously using BPT, but we can't access the local storage actions in BPT.
So I realized Caching would be the way to go, where I can directly cache the data fetched from image urls.
Please do let me know if there's another way I can approach this problem.
After the BPT executed, you need to implement a mechanism that allows you to sync to the device.
Check these links:
Implementing off-line sync: https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Offline/Implementing_Offline_Sync
Offline data-sync patterns: https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Data/Offline/Offline_Data_Sync_Patterns
Component from forge: https://www.outsystems.com/forge/component-overview/1638/offline-data-sync-patterns
Regards,
Hello Amol,
I agree with @Goncalo Almeida, local storage is indeed the way to go. Here's a link to a similar question and the recommendation - How to cache images in mobile app | OutSystems
If needed you may check out the section on how to build a light weight local storage here - OutSystems Mobile Best Practices - OutSystems
Best regards