Skip to content

In the car ​

CarPlay, Android Auto, and Android Automotive all show your content on the car screen and play through the same player as your app. You don't build a separate "car app" — the car surfaces are driven by the same cross-cutting pieces you've already built:

  • your browse tree becomes the car's browsable menus,
  • your now-playing metadata fills the car's now-playing screen,
  • the player and queue are shared, so playback is continuous whether the user started it in-app or in the car,
  • your search source answers in-car voice commands ("play jazz"),
  • your favorites are one state shared by the app and the car. With capabilities.favorite on, Android Auto shows the heart; CarPlay shows it once you list it in ios.carPlayNowPlayingButtons (see Favoriting from system controls). Only Siri understands "play my favorites"; Android Auto searches the phrase as plain text.

Build those once and they light up every car surface. The per-platform pages handle the platform-specific setup: Android Auto (also Android Automotive) and CarPlay.

Shared vs platform-specific ​

ConcernWhere it's handled
Browse tree / menusShared — Browser
Now-playing metadata & artworkShared — Now Playing
Player, queue, playbackShared — Playback
Voice search ("play …")Shared — your search source
Favorites stateShared — Favorites
App setup, entitlements, manifestPer-platform — Android Auto / CarPlay
Now-playing buttons, the heart among themPer-platform — Button layout (Android) / ios.carPlayNowPlayingButtons (iOS)

The takeaway: spend your effort on the shared content model; reach for a platform page only for that platform's setup and buttons.

Detecting a car connection ​

To adapt your in-app UI while connected to a car (a "now playing in your car" state, a simplified screen), use useCarConnected(). It's true for a CarPlay connection on iOS, and an Android Auto or Android Automotive connection on Android (false on web):

tsx
import { Text } from 'react-native'
import { useCarConnected } from 'react-native-audio-browser'

function CarBadge() {
  const inCar = useCarConnected()
  if (!inCar) return null
  return <Text>Playing in your car</Text>
}

Outside React, read a snapshot with isCarConnected() or subscribe with onCarConnectedChanged (addListener returns an unsubscribe function):

ts
import {
  isCarConnected,
  onCarConnectedChanged
} from 'react-native-audio-browser'

isCarConnected() // boolean

const unsubscribe = onCarConnectedChanged.addListener((connected) => {
  // ...
})
// later: unsubscribe()

Next steps ​

  1. Set up the platform(s) you ship to — Android Auto (and Android Automotive) and/or CarPlay.
  2. Make sure your browse tree and now-playing are in good shape — that's what the car renders.
  3. Wire your search source so voice commands work in the car.