CarPlay keeps changing audio source
I have a problem that is driving me crazy. CarPlay keeps changing my audio source back to the Music app or whatever was last playing through the iPhone (iPhone 11 Pro, 64GB). It did this several months ago but then the problem went away on its own and I figured it just got fixed with a software update. When I listen to the radio or Sirius XM, it will change the audio source to the iPhone. When I switch back to the radio, it does it again. The only way I can listen to the radio is by disabling CarPlay. Something is making the phone think I want to listen to it and not the car's onboard entertainment sources.
The problem is definitely with CarPlay and not the cars because this problem is occurring in both of my vehicles. I have a 2020 BMW M340i and a 2019 Mazda CX-5. The BMW connects to CarPlay wirelessly whereas the Mazda is wired through USB. But the problem is the same in both cars. I have tried unpairing the phone and reconnecting it. I have tried restarting the head units in both cars. I have tried hard closing all the apps. I have tried restarting the iPhone but the problem persists.
It seems to be a software issue because I had this same problem when I was using my iPhone X. Like I said, the problem went away on its own and I thought that it got fixed with an update of iOS. But now the problem is back with avengence
Any solutions to this problem would be much appreciated.
iPhone 11 Pro, iOS 13