Is there a library or a sample app that shows how to handle background processing in Kotlin multiplatform?
10/31/2023, 10:45 AM
i guess u should implement kotlin coroutines
10/31/2023, 10:46 AM
I mean while the app is in the background
10/31/2023, 10:47 AM
then i think u should make implementation for each platform unique one.
10/31/2023, 1:51 PM
I don’t think anything exists quite yet. You can use WorkManager for Android and BGTaskScheduler for iOS, but you’d have to implement each one individually. Coroutines only work for apps in the foreground, and they cannot start an app that’s not already running.
I’ve recently started playing around with a library that wraps those and provides a KMP API on top, but it’s still in the very early stages of development. If you’re interested in following the progress or would like to help contribute to this feature, you can see the preview announcement here https://kotlinlang.slack.com/archives/C03GTEJ9Y3E/p1697648634102369