setStartForegroundService

Sets startForegroundService field. False by default.

Parameters

startForegroundService

If true, a foreground service will be started to keep the navigation active even when the app is in the background. If false (default), navigation may be interrupted if the app is backgrounded or the system is under memory pressure.

From Android 14 (API level 34) onwards, to display a persistent notification
associated with the foreground service, you also need the
android.permission.POST_NOTIFICATIONS permission.  If this permission is
not granted, the foreground service will *still run correctly*, but the
notification will not be visible to the user.

The foreground service will be stopped when either INavigationApi.stopNavigation or INavigationApi.dispose is called.