Tip:
Highlight text to annotate it
X
Hi, my name is Lisa Wray, and I want
to talk to you about some huge changes we've
made in how notifications work in the L developer preview.
The changes give developers tons of options
to make notifications way better for your users.
Now that they appear front and center on the L lock screen,
and Android Wear watches, creating great notifications
is more important than ever.
With the L developer preview, we introduce Google's new material
design language.
Material design isn't limited to Android apps.
It also encompasses the system UI, including notifications.
So here's a notification screen in Jelly Bean
and another in the L developer preview.
Notifications are now on a light background with dark text
and there are also some typographic and graphic design
changes.
If you've been following our guidelines since Jelly Bean,
your notifications small icon should already
be white with alpha.
In L, we expect this, and we draw it
on top of a circular background whose color you can customize.
When you add a large it will turn your small icon,
and it's colored backdrop, into a badge on the large icon,
rather than sending it over to the other side of the view,
as in previous releases.
If you're using Notification.Builder,
or notification compat, then these changes
are taken care of for you.
And your notification should display correctly,
on both pre L and L preview builds.
However, if you're using custom notifications,
you'll need to update your layouts
to match the new format.
So we encourage you to use builder
to make notifications, if at all possible.
In addition to visual changes, we've
merged the notification shade, something
we've in Android since 1.0, with the lock screen.
One of the most common reasons people
take out and unlock their phones is to respond to notifications.
Now content is immediately accessible and interactive.
You can double tap to access or swipe to dismiss right there.
And as a developer, you get this for free.
It's the default behavior in L.
Of course, security is something we take very seriously.
We don't want to expose anything that should be private.
So we've added visibility for notifications.
There are three levels.
The first, which is the default for all existing notifications,
is private, meaning the contents won't be shown on lock screens.
You can provide a public version of your content
or the system will make a generic one for you.
There's also public, meaning the notification
is always shown, no matter whether the screen is locked
or not, and secret meaning if your screen is locked,
then we won't show the notification
on the lock screen at all.
Users can also enable or disable their lock screen notifications
completely, and decide if they want notifications
be kept private or not.
Also new an L are heads up notifications,
a way for the system UI to put important information
in front of the user, without disrupting their activity.
When the screen is on and unlocked
important notifications will be automatically shown
as heads up.
For example, notifications that currently
use a full screen [INAUDIBLE] or high priority with a sound
or vibration like phone calls, will become
heads up notifications while the phone is in use.
After a few seconds, they slide away,
so you can continue playing or reading,
and will move into the notification bar-- for example,
to say call missed, or alarm snoozing.
And we've had notification priority since Jelly Bean.
But it's especially important now
to take a look at your apps notifications
and classify them appropriately.
Many default priority notifications
are probably better expressed as low or minimum priority,
or possibly high priority, if the message is truly urgent.
We've also added notification categories.
It's OK not to specify a category.
But some examples of top priority messages
that should have one are incoming calls,
instant messages, or alarms.
And we're fleshing out notification extras,
which were added in Kit Kat.
In particular, we want to help you see information
about the people you care about.
So you can add a list of the people associated
with a notification, identified by content provider
your eyes, so the Android system could surface notifications
from your favorite contacts.
And it's especially important now
that your app use only the notification features
to play sounds and vibrate.
Please don't work around the notification manager
to vibrate or play your own sounds.
With all these options, we've given users a convenient way
to configure notifications for any app.
You can add a flag to your notification settings activity
in the manifest to have it listed in the app notification
section of the system settings up.
Also, lock screens in the L developer preview
no longer show controls for your remote control client.
Instead, your app can provide media playback control
from the lock screen to your notification.
And there's a new media style template just for this purpose.
Finally, don't forget the notification options
already available for Android Wear.
Your app's existing notifications
automatically transfer to the watch for free.
But with just a little bit of extra code,
you can get support for pages, stacks, voice replies.
Conversely, if you don't want your app's notifications
on the watch, you can use set local only true.
And this, like the new media style,
is available both in the notification class
and in the support library.
So that's a lot.
What should you, as an app developer,
go do right now to get your notifications ready for L?
Use Notification.Builder or create new layouts for pre
and post L. Pick an accent color for your notifications,
because that's new.
Decide what visibility you want your notifications to be.
And if it's not public, then think
about what you'd like to show on the lock screen.
Add a flag in the manifest to get your notification setting
activity listed in the system settings.
And if you don't have a notification setting activity,
go make one.
And finally, if you have notifications,
your app is already on Android Wear today.
So make sure it's working the way that you want.
If you don't have a watch yet, use the emulator.
And you can get started today with all of these new features
by downloading the Android L developer preview.
And check out the docs on notifications
on developer.android.com.
Thanks for watching.