Google Assistant helps drivers perform tasks they're already doing while driving. It reduces distraction by providing glanceable, voice-forward multimodal experiences. Driving mode helps make every drive safer, more informed, connected, and enjoyable.
Using driving mode
A device automatically enters driving mode when you start navigating in Google Maps.
To disable driving mode:
- Navigate to Google Maps Settings > Navigation Settings > Google Assistant settings > Manage Driving Mode.
- Turn off the Driving Mode setting.
App prerequisites
In order for driving mode to work correctly with your media app, the app must meet these requirements:
- Follow all the directions in Google Assistant and media apps
- Your app must declare that it supports media for Android Auto. Follow the directions at declare media support for Android Auto.
- Handle audio focus
- Use
PlaybackState
to report errors - Implement a MediaBrowserService and a MediaSession
- Your MediaSession must implement these callbacks:
onPlay()
onPlayFromSearch()
onPlayFromUri()
onSkipToNext()
onSkipToPrevious()
onPause()
onStop()
- Keep the
MediaSession
metadata current by callingsetMetadata()
.
Driving mode and playback controls
Each app determines the transport controls that appear on the screen. Do this
by connecting its MediaSession
to TransportControls
.
For example, a music player usually shows these controls:
Any other supported actions are invoked via voice commands.
Media recommendations in driving mode
Driving mode displays recommendations in two places, the "For you" page and the app's browse page. The screens look similar:
The Assistant calls
MediaBrowserService.onGetRoot()
with the hint
EXTRA_SUGGESTED
to retrieve recommendations. You should return a flat list of playable
MediaItem
objects. The
app's browse screen displays all the items in the list. The "for you" screen
is not guaranteed to show the recommendations at all if there are less than
15 items in the list.
Each MediaItem
must have media art. You can provide
the type of a MediaItem
by adding a CONTENT_TYPE
key-value pair to the
Bundle in the
MediaDescription of each
MediaItem
. This helps improve the item's ranking in the "for you" page.
The possible values for CONTENT_TYPE
are:
- ALBUM
- ARTIST
- PLAYLIST
- TV_SHOW_EPISODE
- PODCAST_EPISODE
- MUSIC
- AUDIO_BOOK
- RADIO_STATION
- VIDEO
- NEWS
Testing
Use the Media Control test app to verify your app.
Known issues
It is important to avoid opening a media app in the foreground
while in driving mode. For example, when the Assistant calls
MediaBrowserService.onGetRoot()
to retrieve recommendations, your app should
ensure that the state of your PlaybackState
is STATE_NONE
. This prevents
your app from being brought to the foreground. Currently there is no way for an
app to detect whether it is in driving mode or not.