Dear Esri,
We are seeing an issue using the Kotlin SDK (currently at 200.8.0) on Samsung S24 phones where the map jumps around while on LocationDisplayAutoPanMode.Recenter (see the attached video). It might be on other phone models as well, but that model is confirmed.
Do you have any tips on what we could try to resolve this?
We have recently updated the app from the 100.x series, and did not see that issue before.
Here is our code which has mostly stayed the same apart from the obvious changes on how location display mode is activated using the Kotlin 200.x.
fun setLocationDisplayMode(view: MapView?, locationDisplayMode: String) {
val locationDisplay = mapView.locationDisplay
// OFF
try {
if (locationDisplayMode == "off") {
setAutoPanMode(locationDisplay, locationDisplayMode)
return
}
} catch (ex: Exception) {
Log.w(
LOG_CLASS,
"ERROR: Could not init and/or stop location display mode: " + ex.message
)
return
}
val status = locationDisplay.dataSource.status.value
// For mode transitions (not initial setup), set the mode directly if location is already active
if (status == LocationDataSourceStatus.Started) {
try {
setAutoPanMode(locationDisplay, locationDisplayMode)
return
} catch (ex: Exception) {
Log.w(LOG_CLASS, "ERROR: Could not set autopan mode directly: " + ex.message)
// Fall through to full initialization if direct mode setting fails
}
}
// Starting
if (status == LocationDataSourceStatus.Stopped || status == LocationDataSourceStatus.Stopping) {
try {
managerScope.launch {
locationDisplay.dataSource.start()
}
setAutoPanMode(locationDisplay, locationDisplayMode)
} catch (ex: Exception) {
Log.w(LOG_CLASS, "ERROR: Could not start locationDisplay: " + ex.message)
}
}
}
private fun setAutoPanMode(locationDisplay: LocationDisplay, locationDisplayMode: String) {
try {
when (locationDisplayMode) {
"autoPanRecenter" -> {
locationDisplay.setAutoPanMode(LocationDisplayAutoPanMode.Recenter)
}
"compassNavigation" -> {
locationDisplay.setAutoPanMode(LocationDisplayAutoPanMode.CompassNavigation)
}
"off" -> {
locationDisplay.setAutoPanMode(LocationDisplayAutoPanMode.Off)
managerScope.launch {
locationDisplay.dataSource.stop()
}
}
}
} catch (ex: Exception) {
Log.w(LOG_CLASS, "ERROR: Could not set auto pan mode: " + ex.message)
throw ex
}
}