Skip to content

Use Coroutines to manage threads#2

Draft
jermy-c wants to merge 8 commits intoupdate-libnodefrom
kotlin
Draft

Use Coroutines to manage threads#2
jermy-c wants to merge 8 commits intoupdate-libnodefrom
kotlin

Conversation

@jermy-c
Copy link
Copy Markdown

@jermy-c jermy-c commented Sep 9, 2025

Coroutines are the recommended way to start concurrent tasks.

My attempts:

  • Using view model to manage the lifecycle of the Node.js thread with viewModel
  • Declaring the coroutineScope at the Plugin level and call cancel
  • Hoping Kotlin terminates the Coroutine when the Plugin is not active
  • Using GlobalScope the app scope so it follows the app lifecycle
  • Using Dispatcher.IO and Dispatcher.Default where it makes sense for speeding up the thread

https://developer.android.com/kotlin/coroutines
https://developer.android.com/kotlin/coroutines/coroutines-best-practices#viewmodel-coroutines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mobile: Manage the backend according to native app lifecyle

1 participant