6

I'm working on an app that will support CarPlay.It's an audio app.

I'm able to show 2 tabs (favourite and recommended) though I just don't know how to show the Now Playing Tab. I just cannot find any info regarding this. Do I have to manually show it, and the, how do I push? Do I have to do it manually? If so, what's the viewcontroller?

Thanks.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
miya
  • 1,059
  • 1
  • 11
  • 20

2 Answers2

3

For the Transition to the Now Playing tab to work on both the simulator and an actual car, you need to make sure to

  • call beginReceivingRemoteControlEvents on the current UIApplication, and
  • set a nowPlayingIdentifier on the MPPlayableContentManager

before calling the completion handler in playableContentManager:initiatePlaybackOfContentItemAtIndexPath:completionHandler:.

DrMickeyLauer
  • 4,455
  • 3
  • 31
  • 67
  • Great! I've done the first and last suggestion and I think this has done the trick. I wonder if the second one is needed but I don't know how to do it. How do you set the now playing identifier? – mike nelson Oct 19 '19 at 02:14
  • @mike-nelson: `MPPlayableContentManager.sharedContentManager.nowPlayingIdentifiers = @[ nowPlaying ]`, where nowPlaying is the ID of the `MPContentItem` you have started to play. – DrMickeyLauer Oct 19 '19 at 15:59
  • Thanks @DrMickeyLauer, this works, it shows a little speaker icon next to the playing item in the carplay list view now. However, the `beginReceivingRemoteControlEvents` actually prevents now playing screen from showing unless I call `endReceivingRemoteControlEvents` and begin again every time play is invoked. This almost works perfectly, except the first time an item plays it refuses to show now playing screen. Any suggestion? – mike nelson Oct 19 '19 at 22:21
  • @DrMickeyLauer please can you help me, I have set things like this but it's not working: https://stackoverflow.com/questions/64059229/how-to-make-nowplay-screen-in-carplay-xamarin-ios-and-how-to-set-nowplayingiden – Divyesh Sep 25 '20 at 09:23
2

I know this post is a couple months old, but for me, I had to test in an actual device with CarPlay. Apple says always test it on an actual device with CarPlay. At first, I didn't see a Now Playing tab in the simulator, but as soon as it was tested in a device it was there automatically. I didn't do anything special. I think CarPlay knows when you're playing audio via MPNowPlayingInfoCenter and does this automatically in the actual CarPlay device.

codenift
  • 25
  • 6