Crul
11/25/2022, 3:27 AMWorkerManager
periodically every 30 minutes in the background to execute some tasks. One of the task is downloading the image from remote server and then store the image file in the local storage. My Questions are
1. How to implement the WorkerManager
that will be triggered every 30 minutes in KMM ? (of course I hope it runs on Android and IOS)
2. How to store the image file in the local storage ? To make things even more confusing to me, currently in Android we have that thing called Scoped Storage
. I’m not sure if IOS has this kind of concept as well. How to get around with this problem ?Michael Paus
11/25/2022, 10:30 AMCrul
11/28/2022, 4:56 AMWorkerManager
. In Android, if we use WorkerManager
we will have this behavior where the worker is still running in the background even when the app is destroyed. I don't think we will get the same behavior if we use loop & delay statement in coroutine right ?Michael Paus
11/28/2022, 10:47 AMCrul
11/28/2022, 11:32 AMKevin S
11/28/2022, 6:14 PMWorkManager
but I would image you could create a service that calls shared code, or even just use your current WorkManager
to call the shared code function.
If you need some guidance on getting started, you can view the KaMPKit
sample project https://github.com/touchlab/KaMPKit. It goes over how to download data online and storing it to a database using SQLDelight
. Not sure if you’d want a database for images but it could at least be a starting point.dewildte
12/07/2022, 9:08 PM