AAConnectionCallback
interface AAConnectionCallback
Callback interface for Android Auto session connection lifecycle events.
This interface handles the fundamental connection state changes between the phone app and Android Auto, as well as screen state transitions within a connected session.
Responsibility
Manages AA session-level events:
Session creation (user opened app on AA)
Session destruction (user exited app on AA)
Screen state changes within an active session
Callers
Methods in this interface are called by AndroidAutoSurfaceManager:
onAAConnected via
setAAConnected(true)onAADisconnected via
setAAConnected(false)onAAScreenStateChanged via
setAAScreenState()
Usage
Implement this interface to react to AA connection changes:
class MyCallback : AAConnectionCallback {
override fun onAAConnected() {
// Show "Connected to Android Auto" notification
}
override fun onAADisconnected() {
// Dismiss notification, re-attach MapView
}
override fun onAAScreenStateChanged(state: AndroidAutoScreenState) {
// Update phone UI to match AA screen
}
}Content copied to clipboard