setOnCloseCallback

fun setOnCloseCallback(callback: () -> Unit?)

Sets the callback to be invoked when the phone app is closing.

Owned by AndroidAutoSession for the entire session lifetime:

  • Set in Session.onCreate() (covers all states including blocking ones)

  • Cleared in Session.onDestroy()

The callback should call finishCarApp() to close the Android Auto session.

Parameters

callback

The callback to invoke, or null to clear