ApplicationScope

@Qualifier
annotation class ApplicationScope

Qualifier annotation for injecting the application-scoped CoroutineScope.

Use this annotation when you need a CoroutineScope that lives for the entire application lifecycle. This is typically used for:

  • Application-wide background operations

  • Data synchronization that should survive configuration changes

  • Observing flows that need to be active as long as the app is alive

Usage Example

class DataSyncManager @Inject constructor(
@ApplicationScope private val appScope: CoroutineScope
) {
init {
// This will run for the entire app lifecycle
appScope.launch {
observeDataChanges().collect { /* sync */}
}
}
}

When NOT to Use

  • ViewModels: Use viewModelScope instead (automatically cancelled when ViewModel is cleared)

  • Composables: Use rememberCoroutineScope() (cancelled when Composable leaves composition)

  • Short-lived operations: Use regular suspend functions

See also