[MUSIC PLAYING]
BEN SAGMOE: Hi, my name is Ben, and I'm
one of the developer relations engineers
covering Android for Cars.
And today, I'd like to talk to you about what's
new with the Car App Library.
To begin with, let me give you some background
on what the Car App Library is.
At its core, the Car App Library is
a set of Jetpack modules designed
to do all of the heavy lifting when it comes to writing apps
that you can use on Android Auto and Automotive OS.
Right now, that's for navigation and point of interest apps.
But it does so by providing a set of templates
that are designed to meet driver distraction
standards across the world and which
are capable of adapting to all of the different car screen
sizes and input modalities for you.
It launched publicly a little under two years ago
and has only gotten more powerful and feature rich
since then.
In this talk, I want to cover the major new features in 1.3
starting with the map template.
With this template, navigation apps
can now also display a greater amount
of information and relevant actions
while also displaying a map.
Like the existing navigation templates,
you must declare the navigation templates and access surface
permissions in your manifest to use the template in your app.
Similarly, you're also responsible for drawing
the map yourself by providing an implementation of the surface
callback interface.
With permissions and map running in place, all you need to do
is build your map template and return it to your screens
on get template method.
When building your template, you must
supply a header and some content,
which can be either a pane or an item list of rows.
There are some restrictions on exactly what you
can display when these are used within a map template,
like not showing an image, so be sure to check out
the documentation for all the big details.
Optionally, you can also specify a map controller
to enable map interactivity, like tapping or scrolling
and other map-related controls.
You can also set an action strip,
which is great for controls not directly related
to the map, such as opening a settings screen or a search
screen.
Next up, we're introducing alerts
to make it possible for users to interact with your app
without losing the context of the app
and routing information.
For example, if there's an increase in traffic,
you can ask if they'd like to accept a faster route,
or if you're a ride sharing app, you
can see if they'd like to accept a rider.
To use alerts, you first create them using the builder
and then display them using the App Manager's show alert
method, pretty simple stuff.
Optionally, you can mark one action
as the default to have it be taken
if the user doesn't do anything before the timeout you set.
In the spirit of providing more context relevant to your app,
you can also now customize the travel estimate.
So this allows you to set an icon, some descriptive
text, or both.
To do so, just use that setTripIcon and setTripText
on the travel estimate builder when you're refreshing
the Navigation template.
Finally, to enable in-app voice functionality,
we're introducing the Car Audio Record
API, which will allow you to record audio
from the car's mic.
As with other form factors, you're
going to need to get your user's permission before you're
able to record audio.
And there's a very helpful method
called request permissions that lets
you do this using the same code across both Android Auto
and Automotive OS.
From there, using the API is pretty
similar to Android's Audio Record API,
but it's better suited for the cars
because it provides the same interface
across both platforms.
And that's it for the major 1.3 features,
but there's a bunch of smaller ones
as well so be sure to check out the release notes for all
the smaller updates.
Finally, after you've implemented these new features,
you'll want to test them out.
With the Developer Head Unit 2.0 now available
in Stable Android Studio, you can test them out easier than
ever with Android Auto.
All you have to do is use the USB flag
when starting the Developer Head Unit,
and your device will connect by accessory mode
just like it does in the car No more fiddling with developer
settings and ADB tunneling.
And with that, I'd like to say thanks for listening.
If your app isn't one that can make use of the Car App
Library, don't worry.
There's a way to reach your users in their vehicles.
Media, messaging, and video apps are also supported.
In addition to navigation and point-of-interest
apps depending on the platform.
So please check out the Android for Cars link.
Ask me later today at office hours or the Device Lab.
Thank you.
[APPLAUSE]
[MUSIC PLAYING]