Extensions Function
fun Location.toLatLng() = LatLng(latitude, longitude)fun <T> LiveData<T>.observeOnce(lifecycleOwner: LifecycleOwner, observer: Observer<T>) { observe(lifecycleOwner, object : Observer<T> { override fun onChanged(t: T?) { observer.onChanged(t) removeObserver(this) } })}
Extensions Property
val Location.secondsElapsed: Long get() = LocalDateTime.now(ZoneOffset.UTC).toEpochSecond(ZoneOffset.UTC) - (time/1000)
References: