Город МОСКОВСКИЙ
00:22:58

Get Location Data with LiveData, ViewModel, and Jetpack Compose in Android

Аватар
Kotlin Инвестиции
Просмотры:
22
Дата загрузки:
01.12.2023 23:41
Длительность:
00:22:58
Категория:
Обучение

Описание

Capture GPS Location, latitude and longitude, from the Android device, and make it available to our Jetpack Compose Android application. To do this, I create a subclass of LiveData, called LocationLiveData. I create a new ApplicationViewModel to intereact with this LocationLiveData class. I update Koin dependencies so that this new ApplicationViewModel will be available to my Activity. Then, I observeAsState() on the live data, and create a Composable function that will show the current GPS location. I update an existing data class with these details, and then store the location data in Firebase Firestore Database.

Рекомендуемые видео