So my app is programmed such that certain geofence exits will wake the app up from suspension.
When this happens I am using the following to see the current audio output
devices:
AVAudioSession.sharedInstance().currentRoute.outputs
With older non-Carplay cars the second you get in the car and your iPhone connects via bluetooth to the car, the connection will show up in the output
array. This way, you can at a glance, tell if the user is connected to their car or not.
However, this DOES NOT work with Carplay cars.
When a user connects with Carplay, the Carplay connection will not show up in the output
array, UNTIL the user plays an actual sound on their car system. So basically, for Carplay user, my app cannot tell the user got in their car until the user plays music, maybe takes a phonecall on their Carplay. The problem is, the user may not play any audio on their Carplay until long after they’ve gotten in their car and started driving already.
Is there a way to see at a glance if a user is connected to Carplay or not?
If the AVAudioSession outputs is not the way, what is a better way?
P.S. Keep in mind this needs to happen in background mode