app-lifecycle

Installation
SKILL.md

App Lifecycle Patterns

Android

SavedStateHandle in ViewModel

SavedStateHandle survives both configuration changes and process death:

class ProductDetailViewModel(
    private val savedStateHandle: SavedStateHandle,
    private val productRepository: ProductRepository
) : ViewModel() {

    // Survives process death
    val productId: String = savedStateHandle.get<String>("productId") ?: ""
Installs
24
GitHub Stars
66
First Seen
Apr 7, 2026