ian lake: remember back whendinosaurs ruled the earth, and android notificationslooked like this? oh my. thankfully, i've seenfewer dinosaurs around. and android notificationshave gotten a lot better.
Android TV notifications, ever-evolving apis don'talways make for the easiest development experience. and that's why there'snotificationcompat. it gives you a single interfaceacross all api levels,
so you can concentrateon building the best notifications you can. i'm ian lake. and i'll show you how you canbuild awesome notifications with the help ofnotificationcompat, helping reengage users whetherthey're on their phone, watch, or in their car. but i'm getting ahead of myself. let's start at the beginning.
every notification has a fewrequired parts-- a small icon, title, and text. to build a notification, usea notificationcompat builder. then build and sendthe notification. done. one fatal flaw. tapping on thisnotification does nothing. nothing! we need a contentintent that points
to the activity wewant to launch when the user taps the notification. but we can do so muchmore with notifications. set a color, to makethe notification recognizable as from your app. set a large icon, andnow we actually know who the notification is from. already you have somethingyou might actually want to click on.
this compact title andtext format is the basic. and all of it's availableon older platforms. but basic shouldn'tbe where you stop. let's make this good. like, really good. on android 4.1 andhigher devices, notifications canexpand, giving you more space to work with,going beyond the title and one line of text.
notificationcompatprovides four styles. which you can use toimprove your notifications, particularly when expanded. you'll find bigtextstyle forshowing multiple lines of text, such as a long message,perfect to actually see the full message. inboxstyle, for showing alist of single line strings. bigpicturestylefor showing a-- you guessed it-- a bigpicture when expanded.
and mediastyle, for addingmedia controls directly to your notification. well, now our notificationhas some room to breathe and gives users alot of information, pulling them back into your app. good. but we're busy people. adding actions toyour notification gives users quick access tothe most important actions,
without breaking their groove. not that i'd ever mute joanna. but notifications aren't juston your mobile device anymore. they're also on yourwrist, with android wear. any actions you've addedto your notification are automatically mirroredover to android wear devices, enabling users to handletasks without even pulling out their phone or opening the app. but mirroring your phoneexperience over to android wear
can only get you so far. to really make things great,you can use notificationcompat's wearableextender. here's where all thewear-specific magic happens. we've talked aboutmirroring actions. with wearableextender,you can build the perfect set of actionsthat makes sense for the watch. including voice replies. again, rich actions thatincrease engagement, even when
the user can't open your app. another example is adding ahigh resolution background image, the easy way to offera literally crisp experience. there's a lot morenotificationcompat's wearableextendergives you though, including adding additionalpages of information to the notification forextra content and the ability to group notificationstogether into a stack, giving you all thedetails on the watch,
but a summarynotification on the phone. ok, so there's a lot youcan do on your wrist. what about an androidauto equipped car? here, messaging apps canuse notificationcompat's carextender to send a message,or a whole set of messages, in a conversation toandroid auto, where they can be read aloud andthe user can voice reply, all while keepingtheir eyes on the road. so, usingnotificationcompat, you
get a single api for allandroid versions, support for progressiveenhancements through adding styles and actions,and even the tools to bring great notifications toandroid wear and android auto. that's a lot of opportunity tomake beautiful notifications everywhere. get started withnotificationcompat by adding the supportlibrary to your project. you'll need app compat formedia style notifications,
or just supportv4 for everything else notificationcompathas to offer.
with the tools you need tobuild great notifications on a phone, tablet, watch, andcar, you can't help but build better apps. [music playing]