Our great sponsors
-
android-showcase
💎 Android application following best practices: Kotlin, Coroutines, JetPack, Clean Architecture, Feature Modules, Tests, MVVM, DI, Static Analysis...
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
In a typical app that fetches data from API (without using Flows), do you prefer to fetch data in a ViewModel constructor (init) or have a dedicated public method called from view (e.g. onViewCreated -> viewModel.onEnter). Here is example of the second approach from the Showcase app (see the onEnter method): https://github.com/igorwojda/android-showcase/blob/main/feature_album/src/main/kotlin/com/igorwojda/showcase/feature/album/presentation/screen/albumlist/AlbumListViewModel.kt