The book states:
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.19.3
then
launch(CommonPool) {
mapsViewModel.addBookmarkFromPlace(placeInfo.place,
placeInfo.image)
}
This produces an Unresolved Ref error.
The solution seems to be the following, but grateful for confirmation:
build.gradle (Module: app)
implementation “org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1”
implementation “org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1”
MapsActivity.kt
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
then
GlobalScope.launch() {
mapsViewModel.addBookmarkFromPlace(placeInfo.place, placeInfo.image)
}