resetToTrackingMode

suspend fun resetToTrackingMode(appContext: Context, onRestoreLocationSource: () -> Unit, idleTimeoutMs: Int = MSDKAutoConstants.DEFAULT_IDLE_TIMEOUT_MS, overlayCleanupDelayMs: Long = MSDKAutoConstants.DEFAULT_OVERLAY_CLEANUP_DELAY_MS): Boolean

Resets the MSDK navigation to tracking mode after guidance ends.

This is a suspend function that must be called from Dispatchers.IO.

Steps performed:

  1. Waits for any in-flight stopSession to reach SessionState.IDLE (max idleTimeoutMs)

  2. Stops the session explicitly if still not IDLE (safety net)

  3. Delays for overlayCleanupDelayMs to let the native renderer finish cleaning up guidance overlays (route arrows, turn graphics)

  4. Calls onRestoreLocationSource for the app to restore real GPS (from demo mode)

  5. Sets NavigationMapViewMode.GUIDANCE_VIEW_AUTO for tracking

  6. Starts a new tracking session

Return

true if the tracking session started successfully, false on error

Parameters

appContext

Application context for stopSession() if needed

onRestoreLocationSource

Callback for the app to restore the real GPS location source (in case demo mode was used during guidance). Called after the session is stopped and before the new tracking session starts.

idleTimeoutMs

Maximum time to wait for IDLE state (default: 3000ms)

overlayCleanupDelayMs

Delay after IDLE for native overlay cleanup (default: 300ms)