startTripSession

@RequiresPermission(anyOf = ["android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"])
fun startTripSession(withForegroundService: Boolean = true)

Starts listening for location updates and enters an Active Guidance state if there's a primary route available or a Free Drive state otherwise.

Starting a session can have an impact on your usage costs. Refer to the pricing documentation to learn more.

If you set withForegroundService to true and your apps targets Android 12 or higher, you should only invoke this method when the app is in foreground. This is dictated by background restrictions introduced in Android 12. See https://developer.android.com/guide/components/foreground-services#background-start-restrictions for more info.

See also

Parameters

withForegroundService

Boolean if set to false, foreground service will not be started and no notifications will be rendered, and no location updates will be available while the app is in the background. Default value is set to true.