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
searchsource answers in-car voice commands ("play jazz"), - your favorites are one state shared by the app and the car. With
capabilities.favoriteon, Android Auto shows the heart; CarPlay shows it once you list it inios.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
| Concern | Where it's handled |
|---|---|
| Browse tree / menus | Shared — Browser |
| Now-playing metadata & artwork | Shared — Now Playing |
| Player, queue, playback | Shared — Playback |
| Voice search ("play …") | Shared — your search source |
| Favorites state | Shared — Favorites |
| App setup, entitlements, manifest | Per-platform — Android Auto / CarPlay |
| Now-playing buttons, the heart among them | Per-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):
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):
import {
isCarConnected,
onCarConnectedChanged
} from 'react-native-audio-browser'
isCarConnected() // boolean
const unsubscribe = onCarConnectedChanged.addListener((connected) => {
// ...
})
// later: unsubscribe()Next steps
- Set up the platform(s) you ship to — Android Auto (and Android Automotive) and/or CarPlay.
- Make sure your browse tree and now-playing are in good shape — that's what the car renders.
- Wire your
searchsource so voice commands work in the car.