2018 GMC Sierra. I did the following Modification to my USB that connects to CarPlay I actually had forgot about it because it’s been working good since. So my carplay2air dongle would also power on when the door was opened, locked the doors or put key in The ignition. This caused it not to boot up properly at times because the stereo needed to boot up first.
so what I did was buy this piece from amazon ANDUL USB Switch Extension Cable, Upgraded USB Extension Cord with On/Off Power Switch Cable For LED Strips, IOS System, etc
https://www.amazon.com/dp/B07T9BRNHW/ref=cm_sw_r_cp_api_i_XuhmEbBS7F1MA
It turns off the power to the usb when you flip the switch but data still passes through. I took this apart and connected a relay to the power wired from this switch. I then connected the power supply to the relay from the 12v power adapter in my center console. This 12v power only turns on when the ignition is turned on. Doing this lets the stereo boot up and power only turns on the dongle when I turn on the ignition. Works everytime now.
This is how I wired my to my center console 12v connection as I confirmed on my truck it only turned on when the key was turned on. * Switched power**
Note. Don’t do this unless you feel comfortable doing this. I’m not responsible for any damages you might cause if not done properly. This is just to show how I did mine....