How to Develop a CarPlay Enabled iOS App

By Natasha Singh on July 30, 2020

Apple’s CarPlay framework enables iOS app developers to integrate their apps to work within a vehicle’s head unit (or Infotainment system), leveraging the head unit as a user interface (UI) for their apps. Since its launch in 2014, CarPlay has rapidly grown in popularity, with all major car manufacturers licensing the technology and with a projected install base of over 37 million vehicles and a 26% marketshare of voice powered auto assistants by the end of 2020. Yet for all its success, there is a dearth of information out there to help app developers learn how to develop CarPlay enabled apps. At Blue Label Labs, we just finished our first CarPlay app for iHeartMedia, and in the process we’ve learned a ton about how CarPlay works and what it takes to take an existing podcasting/music player app and bolt on a CarPlay experience to it. In this post, I hope to demystify what CarPlay is and help other app developers on how get started with building for CarPlay.

What kinds of apps can be built for CarPlay?

Many developers might be licking their chops at the possibilities of what they can build into CarPlay, but before you get too excited, Apple restricts very tightly the types of apps that can be enabled for CarPlay to:

  • Navigation (i.e. Waze)
  • Messaging  & VOIP (i.e. WhatsApp)
  • Music Player/News/Podcasts (i.e. Spotify, Overcast)
  • Parking (new for iOS 14)
  • EV charging (new for iOS 14)
  • Quick food ordering (new for iOS 14)

If your app doesn’t fall into one of the above categories, then I am afraid your CarPlay dreams will remains just that.

How does CarPlay work?

Most cars today contain a head unit which is the central sub-system that controls playing the radio, making calls, performing route navigation which is also colloquially referred to as an ‘Infotainment system’. In addition to this main head unit, cars that are equipped with CarPlay have a separate head unit that lives beside the car’s in built Infotainment system which is responsible for communicating with the connected iOS device and uses that data to display information to the driver and control the vehicle’s hardware. This is why when you launch CarPlay in a vehicle, it looks and feels like CarPlay is taking over the entire Infotainment experience of the vehicle, because it is essentially doing that (newer vehicles allow for CarPlay to control certain components of the Infotainment system like navigation, while the inbuilt vehicle system handles other systems such as media playing). For a deeper explanation in the specific mechanics of how the CarPlay sub-system works alongside a vehicle’s head unit, I recommend reading this fantastic article which breaks it down into much greater detail.

How do CarPlay enabled apps work?

The first thing to understand about building an app for CarPlay is that there is no such thing as a separate CarPlay app, but rather the CarPlay experience is an extension of an app that is running on an iOS device. Think of CarPlay as an additional user interface to an existing app on the device, one which can accept touch inputs and display results to the user. Once the CarPlay head unit is active, it forwards touch events from the vehicle’s screens to the iOS device via USB (and soon WiFi), where upon the app logic running on the device processes it and returns a result which is then displayed in the car by the CarPlay head unit. For those of you who built apps for the 1st generation Apple Watch, this whole approach might sound oddly familiar to that experience, because it is. There is no app code running within the vehicle’s head unit, it is running within the app on the device, which means it is able to access and share the same memory and other resources contained within the main iOS app’s running container.

How much work does it take add CarPlay support to an app?

If you have an existing app that falls into one of the aforementioned categories, building a CarPlay experience for the app is generally a not a lot of work, because of the strict rails Apple puts in place for the UI a CarPlay enabled app can expose to a user. Building for CarPlay doesn’t mean you can build any type of interface like one would for a native iOS app. CarPlay provides a set of fixed UI templates and controls that all CarPlay enabled apps must conform to, and within that already minimal set Apple further restricts which templates can be used depending on the app type being built. Thus, by virtue of the fact that there is a very limited palette of UI controls available to display and that the CarPlay components can leverage the same underlying infrastructure of the existing app makes adding CarPlay functionality a relatively straight forward exercise.

How much UI customization is available to a CarPlay enabled app?

Honestly, not much. For a podcast or music player app, Apple controls very strictly the UI displayed in the vehicle’s screen allowing almost no customization of the template provided. For a music player, CarPlay restricts apps to a tab-based navigation flow, with each tab being populated by a simple list of tracks,  and a canned ‘Now Playing’ screen in which the only control the app has is to customize the functions of each button CarPlay displays. That’s it! A music player app can only have those screens, built to the exact same layout, no more or no less. The lack of flexibility afforded to music players within CarPlay actually makes it very easy to adopt an existing iOS music player app for CarPlay, essentially boiling down simply returning the right list of tracks based on the tab selected by the user and then handling the touch inputs for the ‘Now Playing’ screen. On the flip side, a Navigation app is afforded much more freedom by CarPlay to customize the UI and how information is displayed to the user, which would require significantly more work to develop a CarPlay experience for than a music player. The greatest flexibility is offered to vehicle manufacturers, who are given free reign to customize the CarPlay UI as they wish.

CarPlay UI Templates for Audio Player Apps

In the following chart you can see each of the available CarPlay UI templates and the app types which are supported for each:

Music Player/News/Podcasts Messaging & VOIP EV Charging Navigation Parking Quick Food Ordering
Action Sheet X X X X X
Alert X X X X X X
Contact X X
Information X X X X X
List X X X X X X
Map X
Now Playing X
Point of Interest X X X
Search X
Tab bar X X X X X X
Voice control X

 

Steps to Get Started Developing for CarPlay

To get started building a CarPlay experience for an iOS apps, here are the following high-level steps to follow:

  • Verify your app falls into one of the acceptable categories to enable a CarPlay experience. (see above)
  • Obtain a CarPlay entitlement from Apple by submitting a request, which you can find here.
  • Upon approval, setup your local developer environment to support debugging a CarPlay extension. The built in iOS simulator offers the ability to project an app onto a second screen which simulates the CarPlay interface. (Note, if you are developing a navigation app for CarPlay, make sure to enable the following command in the Terminal prior to launching the iOS Simulator: defaults write com.apple.iphonesimulator CarPlayExtraOptions -bool YES)
  • Begin developing your CarPlay support within an existing app, which will generally consist of:
    • Adding the CarPlay.framework to your XCode project.
    • Implementing a special CarPlay specific app delegate that implements the CPApplicationDelegate interface and setting the appropriate root view controller.
    • From here, depending on the app type you are building, implement the appropriate templates specific to the app type.
  • While testing on the simulator is a good starting point, you will save a lot of heartache and frustration by purchasing a real CarPlay enabled head unit to do hardware testing on. You can find these for cheap on Amazon, we used this one which supported both CarPlay and Android Auto and only cost $75.
  • With a CarPlay enabled app there are certain test cases you should be thinking about and trying to simulate with a test head unit, such as:
    • How does the CarPlay experience behave when a user receives a call or if the backup camera is initiated and the CarPlay process is suspended?
    • How to handle seamless transition of playback of music or other content from the device when it is connected to a CarPlay head unit?
    • How to post and display visual notifications to the screen when the user might be using another CarPlay app?
    • How to properly display progress wheels and status indicators to the CarPlay screen when the app might be fetching something from the web?

In conclusion, building a CarPlay enabled app is a relatively straightforward exercise for an experienced iOS developer. The most difficult parts of the whole process is the paperwork and approvals necessary to jump through Apple’s approval process followed by the on-device testing to ensure the app behaves appropriately on an actual hardware head unit. Our team at Blue Label Labs took on the challenge of building a CarPlay app head on and we’ve learned a ton about not only how CarPlay works but also how the Infotainment systems within modern vehicles behave. If you are looking to build a CarPlay enabled experience for your app, please reach out to us to see how we can help bring your app to life inside of a vehicle.

Get the latest from the Blue Label Labs’ blog in your inbox

Subscribe

* indicates required