What’s new with Notifications in Android N and Android Wear 2.0 – Google I/O 2016

What’s new with Notifications in Android N and Android Wear 2.0 – Google I/O 2016



alright let's get started thank you everybody for showing up at 9 o'clock on Thursday morning I very much appreciate it it's great to see you here weathers a little better so hopefully today is more fun for everyone um I guess we've already jumped ahead to our extended version of the title of this talk and we just stuck with what's new and notifications and Android and okay I see what it is I'm just resting my thumb on the advancer and so that's the problem we definitely rehearse this I swear I promise to everybody I'll bump back here for a little bit and just try it say we're gonna talk about notifications today but we're gonna spend about half our time talking about Android wear 2.0 because that got a great big review yesterday at the keynote and I thought the comedy session was this evening not not right now all right well we'll deal with it my name is Dan Sandler I'm the lead engineer on the Android system UI team which is EV all of the stuff you can see on the screen that's not any other app and I'm Alex Hills I am an engineer on the wear system UI team which has the exact same description but smaller and attached to a body advancing some to still advance oh man this thing is this it's it's on its own alright we're just gonna keep moving so we've made some changes in Android notifications this year we make some changes every year this is kind of a big change this year because we've messed with the templates I mean you see here we've actually messed with the templates many times in the past this is probably our first big I'm just gonna set this down I'm just gonna set that thing down we'll advance maybe by hitting the arrow buttons in and we've changed it again but the reason we've changed it is to bring things more in line with material design and to make things a little more scannable generally we've got room for a little more text you have the ability to okay I actually do need to do the builds now all right here we go fantastic okay so we've made that we've cleaned things up they're a little less busy we've hit our material key lines now instead of winging it like we did before you now see that we can tell you exactly which app posted each notification that's accountability for you the end user which we never really had before unless you knew to long press in the notification so that's good and we've taken the icons out of actions mostly so that you've got more room for those long labels that might show up in some translations and then finally my personal pet peeve about notifications since we introduced expandable notifications in jellybean is that you can now tell what's expandable there's an expansion widget a little chevron that appears next to the app name that lets you see oh there's more text here and if I touch that you can actually click it and it expands the notification just this slide here is there anything that we can do to avoid like racing through I mean I race through stuff anyway but I mean this is ridiculous all right we're gonna hold it right there let's see let's see what happens I move the mouse around I'll turn around three times in spit if that doesn't work hi this is a slide that you're not supposed to be able to follow it's like a London Tube map which I certainly can't follow I just want to move ate that all of the old information is still here in the templates to just move down it around to a new place so if you're already using the notification builder api's will take care of all that for you we'll move it into new spots another thing that's useful to know particularly as an end user is sort of where you can actually touch on things so here the hit targets I just want to make a note that even though that expand indicator is really small the hit target forward is really big you touch anywhere on that top row you expand the whole notification so if you as a developer have been using expanded notifications and you're worried that like no user knows how to find it this is how there's a button you can touch finally after three years so I mean you can touch buttons applause seriously and I don't know what this thing this thing really likes me to do so what do you have to do if you're using the Builder like I said you don't have to do everything everything is already going to be moved to the new templates for you if you're doing custom remote you remote views you have a lot of work to do as you have every single other release because remote views you have to Reese Culp everything from scratch to make sure that it matches the new template design but help is finally on the way for the very first time we have a new template that is just designed to say hey I've got some custom content to put in the middle of this view but please system decorate the rest of it exactly the way I suppose to be done so we call it decorated medias are a decorated custom view style and what you can see here is essentially a schematic of the orange section you just do whatever you want inside a remote views just like you did before with custom remote views but the system will then put in the expanded indicator the app accountability the app name at the top and even putting the actions for you at the bottom so if you've got a custom weather widget or something like that but you want to have it match the system style you're good to go another big new thing that is new and an we didn't talk about it much at the keynote yesterday but if you've been playing along at home with the n Developer Preview you've seen this is that we are now finally finally finally supporting groups on the phone um use this one all right thanks lemon we have an amazing crew here today thank you very much we actually added a notification group to all the way back in API 20 for Android wear and of course you've got this awesome screenshot from like centuries ago showing the original wear point at one point Oh view of how the notification groups look is a stack of cards and on the phone yeah you just see a summary right you just see one thing usually you do inbox style to mask over what would have otherwise been a group of really nice notifications now you can do this on the phone as well and on tablets it the exact same API is move forward so if previously your app was you know doing some sort of you know looking around to see if the wear companion was installed don't do that anymore just post all of your notifications in that group which you associate by group key and they'll show up this way each one of those notifications is its own full notification so it can be expanded it can have its own actions and everything it's really really outstanding if you haven't used this API before it's really easy to do you say set group when you're building a notification with builder the string that you pass basically becomes a collocation key that we use to collect groups together by name you still want to use a summary notification for two reasons one this is what will show on phones pre n right because we don't know how to do groups pre end so we just show this summary but in n we'll take that summary and we'll extract little bits and pieces of it to make you see that little that little header row right at the top above the bundle we actually pull that information from the summary so if for example you're displaying group that represents one inbox right or one account in your map that might be the place that because of the summary we know okay that's the account name and that's what we'll put in that summary row but then they each individual conversation or each individual email thread then goes into its own notification in the group and finally if you want to make sure that those things up here in the correct order use set sort key will just sort them again on that string lexicographically to make sure the notification is show up exactly the way you want them to see the other big end-user feature on now it's not going all right there we go the other big end-user feature for notifications in end that you developers need to know about is direct reply and we had this on where as well where you could essentially post a notification that somebody could then talk to the watch and then that text that immediately be sent back to the app and you can send an SMS with it now we have it on the phone and in fact you just type directly into the notification shade itself it's really awesome particularly from the lock screen so I've got a nice little build here you can see you got a new message you touch reply and you're just typing right in there even if it's on the lock screen it's fantastic if you've never used this API before because again it's it was introduced with API 24 where if you've never used it before you want to build something called remote input remote input is something you hang off of an action that says by the way if you know how to send me text back please do it in this way and so you set up a specific key so that when you get your intent back from that action click you can extract out the text that was entered something I want to point your attention to if you've already been using a remote input you probably have an activity there as the pending intent on the on the input in and it really really needs to be for that action it means to be a service or a broadcast receiver and here's why if you have an action within activity intent on the lock screen the lock screen is going to say oh the user wants to go somewhere when I click this thing and it's gonna pop up that authentication challenge it's going to pop up the pin pad or the pattern or fingerprint or what have you but what you want to do for a remote input where you want the user to be able to just type straightaway on the lock screen is make sure it goes to a background thing like a broadcast receiver or a service so that there's no authentication required now if you're panicking and saying oh oh hang on I don't want my users to be you know allow people to send SMS is on their behalf from the lock screen that is an end-user setting so if you go into settings as a user you can say do I want to be able to type in two things on my lock screen or not so that's covered by system settings you don't have to worry about it all you have to do is make sure that that remote input is available for users who do want to opt into that feature to just type type away from the lock screen or anywhere else one last thing I do want to point out when you set up that room Wow you know what I'm glad this is happening here in this room as opposed to like yesterday during the keynote I'm cool with that so when you've got your broadcast receiver you just want to make sure you use this method remote input get results from intent that's the way that you extract that text back out and all of this sample code is just stolen mercilessly from our developer Docs so particularly if you download DP 3 the Developer Preview for Android all this stuff is going to be in there you don't have to copy it down you can sketch in Odin if you want you'll be able to pull this directly into your app and get remote input running another thing that I wanted to mention is after you get a reply so so here's the flow you post a notification the user touches reply it types directly in it you get the intent back extract the text great this is what the user wanted to send as a comment or an SMS or whatever what do you do now so previously when people do direct reply there our pattern was that you just dismissed the notification you assume the user is done with it not anymore we assume now that in an a user is going to decide to dismiss that notification whatever they want this way they can post you know one or two quick messages in rapid succession without losing that context so after you get a remote input direct reply leave the notification up and more than that you actually want to re notify to signify oh yeah we got it we got this it's been posted and we have this API called set remote input history that basically all it does is draws a little line underneath your existing notification content whatever it was and then puts in any reply text that you want so you can make a UI like this where you say oh you've left that comment and the user knows okay this transaction has been completed I don't have to wonder whether it's been posted I'm set so this works really well for something like leaving a comment on a picture or something like that where you have the original notification content and then you've got replies that sit after it but that doesn't really work all that well for a chat because chats are back and forth right you say something they say something you say something they says something set remote input history it doesn't quite cover that case we've got something even better but I'm gonna hold that off and let Alex talk about that because that's real fun in fact why don't you go ahead and get started that the clickers fidgety maybe it likes you better than me let might it might or maybe it'll advance seven times for each time I click that's right great all right so dance told you a little bit about how n brings some pretty big changes to the visual style of notifications on the phone well I think that I'm gonna one-up him and say that Android wear 2.0 is the biggest notification redesign in the history of Android wear which also happens to be the only notification redesign in the history of Android wear but I got one up Dan anyway so you know I'll take it before I start I do want to mention briefly that while this section applies to all notifications on wear it's mostly geared towards bridge notifications coming from a phone app if you want to learn some other ways to approach this for notifications coming from a local wear app you can go to the making wear apps more standalone talk at 2:00 p.m. or view our deaf Doc's it doesn't like me there we go so the very first impression that a user gets of your apps notification is the card itself in the context Stream let's talk a little bit of history in Android wear 1x cards were cool you can specify different card heights at big background images for visual context you could toss in or hide a small icon or a Content icon and get all sorts of different fonts and treatments all these features provide a lot of visual richness and impact to the cards themselves that said the richness could sometimes backfire like when the background image itself was mostly obscured by the card itself or diversed font treatments made it hard for a user to actually determine what was most important for a notification at a glance we thought about this but what the purpose of a notification card is about the importance of high glance ability and change things around a little bit in where 2.0 notification cards now look a little different visually all the same components are there like when I promise they're all there but we've made them a little more consistent and more information first we've switched from our card base design to a dark bold material theme we now use color to start telling the story the color that you app that your app sets in the notification now applies to the entire notification surface immersing the user in your content explicit typography intentional treatment help give the user focus for the most important information first the color treatment also serves to bring a bit of visual consistency and coherence to the notification because you set the color from your app notifications coming from you look like they're coming from you a notifications coming from another app look like they're coming from another app the other part of this material update is a set of changes to the layout of the card itself remember though like I said before all the same content is there you can look at this right over there and trust me got it list it out and broken out for you it's just switched around a little bit first off we take a one-size-fits-all approach to the actual notification all notifications are the same size one screen no more different card heights second we've taken the large icon in the background that nice rich icon there and we've brought it to the front of front and center of the notification it's no longer partially obscured by the card or anything like that we've also brought yes we've also brought the small icon from the card itself to well it's still actually on the notification but we brought it down to the bottom right of that large icon finally the content text and title are centered we've made the font treatment a little more consistent with an emphasis on glance ability now that you know what your notification looks like I'm going to put it in the context of the actual system a little bit more history and Android wear 1x the contact stream could be a bit confusing to navigate the stream was ostensibly a single and length vertical list of your notifications however each of those n notifications could also have an M length vertical list of cards creating a sort of M by n like big scrollable space you can just sort of watch the interaction on the screen and kind of realize you can page down the stream one two three a couple more times and then page to the right a couple times at that point remembering how to get back to where you were going from say row five column four to row two column one became a mental exercise in memory and pathfinding which is not exactly ideal when you were trying to rapidly triage your notifications on your tiny little wrist computer on the other hand the context stream in Android wear 2.0 is pretty simple to navigate like and 1x the stream is ostensibly a single end length list of Virgo notifications unlike in 1x that's it simple easy no pathfinding also just a quick note we fixed one of the things that bugged me the most about the old stream where you could sort of like flick from card to card to card but if you had say seven or eight or nine or ten notifications you actually could only go one at once paginating through them now we've made it possible to vertically fling through those notifications from top to bottom bottom the top etc again sort of a big ol point there for rapid usability now if you've been thinking about the implications of what I've been saying here you've realized that a one-size-fits-all approach might not actually fit all of your content in fact because smartwatches are very small it probably will not fit all of your content and some of it will be clipped to solve this problem Android wear 2.0 introduces expanded notifications now in the new stream the entire notification is a tap target tapping that notification launches the expanded notification experience this is automatically rendered with where to point owes new material guidelines which allows you to provide a lightweight app like experience to your users with minimal effort all of the notification content is arranged vertically in a single script surface with the content first followed by the primary action at the end all the other actions that you add to your notification are put in the wearable action drawer component which is a new component you can learn more about by going to the Android wear 2.0 material design session at 3:00 p.m. now what do you need to do to enhance your notifications with this a new rich experience nothing you get it all for free this example here is one of the simpler notifications that you can build it has a text title icons an action 3 those things are actually necessary to even build a notification in the first place and you do this and all of that nice material richness just comes along for the ride that said if you want your notifications to really pop to be information rich and visually impactful you may need to take full advantage of the notification styles and templates as you can see here expanded notifications can be both information dense and visually engaging you can use templates like big text or big picture and you can add extra pages to get even more information into the vacation itself I'm going to dive into each of these in a second but you can see here the level of richness and visual diversity that you can get in an expanded notification the first example there was a big text notification which you can see here with the text content rendered in the stream and on the expanded notification surface however that notification also has an action with the remote input that Dan was talking about that we have had for a couple years and choices which are rendered directly on the expanded notification itself which allows users to take action directly or even respond without having to talk or type from the notification surface the next example was a notification with two big picture cards added to it whose images get put straight on the expanded notification surface which creates a sort of immersive photo viewing experience just from a notification now I'm about to show you some code for all of this so just look closely to remember what we're actually going to be building this is most of the code now those two images are extra pages in the notification and extra pages are actually notifications in their own right so we're going to create a notification first then we're going to set that notification the style to a big picture style and then attach your image to the style with a simple chain method call on it to make the second big picture copy/paste works just as well in code as it does in slides so just do that and then to actually add those pages we're going to need to create a wearable extender and add those to notifications as pages to it finally we're gonna build the notification itself by creating a builder setting the title text and icons and finally extending the notification with the wearable extender that we built earlier the rest is as simple as calling notification manager notify and you'll end up with an expanded notification just like that with this rich photo viewing experience now I do also want to mention that extra pages can be heterogeneous and you can mix mix and match them to get exactly what you want this lets you make rich notifications like this one for a users ticket to see space fights seven notification has three extra pages containing a QR ticket movie details and the plot synopsis as you can see here all of those pages are stacked vertically in the order that you add them which essentially allows you to use extra pages as kind of building blocks to construct the expanded notification exactly as you want this makes it easy to create an engaging and useful way or experience without actually having to make an app finally I'm going to talk about one of the keynotes of where to point OHS communications improvements messaging style messaging style is an entirely new notification style introduced with Android wear 2.0 which gives users a full back-and-forth chat experience right in a notification when a user taps into the expanded notification itself they're going to have access to the full context of their conversation letting them get say right back to the work chat from the day before or the conversation with their friends about how spaceflight 7 was really awesome way better than the prequels and maybe even lived up to the originals you also notice that the chat history includes sender names their meaning that group conversations work well too that said messaging style is not just about formatting you could theoretically do all of this yourself with a big text and actually most of you who have messaging apps already are and just adding it as an extra page with wearable extender the real key to messaging style is actually how messaging style and remote input work in concert to give the user this experience unlikely use other uses of remote input replying the user replying won't actually drop them out of the expanded notification instead their response is going to show up immediately inline on the notification surface itself this means that users are going to see their messages instantly in front of them before a round trip to the phone and your app has completed this makes the user experience very responsive and fast and feels just very good all up if you're a pre posts the notification with new content it will also update in place meaning that responses and replies by other users also show up in this surface without the user having to say go back it go out and back in or reit app a notification or anything it's all right there giving that full back-and-forth chat experience in the notification now you're all savvy developers and have probably noticed that these remote input choices have been really good way better than they should be that you also may actually have mentally linked that to David's talk in the keynote if you're especially savvy but the summary is that in the future we are going to be bringing smart report the smart reply feature from inbox and allo to messaging style notifications on wear meaning that you as a developer can optionally give your users dynamically generated quality contextual responses to pick from all for free good yeah it's very cool like let's be clear now I'm gonna talk about a little bit of code to actually use messaging style and to get it to work end to end you're gonna need to create a reply action with a remote input while technically not necessary as I mentioned before the real goodness of messaging style comes from how the messaging style and remote input work together just one on their own is only gives you a sort of half of the experience now this slide is actually completely shamelessly copied from Dan slide which is in turn shamelessly copied from our developer documentation including the Android version call-out so all I'm going to say now is that you need to do this and move on creating the messaging style itself is actually very simple you simply need to create a new instance of messaging style with the reply name that's going to show up when the user replies in place and then add all of the previous messages from the conversation to the style by calling add message with the text time and sender finally you just need to build the notification itself build it as normal set the style to messaging style and add the action that I completely glossed over and call notify that's really actually all there is to it if you notice and we're paying attention that's a little bit easier even than just adding two pictures to a notification in the first place now with that code we've just gone through on your phone app you are able to give you your users a full back-and-forth chat experience on Android wear that's it nothing else no to go back to about 10 ish minutes ago when Dan mentioned that there was a better way of doing chat notifications on the phone than using set remote input history I have some good news we learned from the path that remote input and notification groups took and this time we're going to be bringing a wear feature to the phone immediately instead of waiting a year or two for it to show up messaging style on the phone works just like on we're using remote input for direct replies as you can see here additionally if the user does still want that full great app experience that you've built and I'm sure they will they just have to tap the notification to deep link into your app just like before now a quick note here is that we put a lot of effort into making messaging style work on Android 2.0 devices no matter what version of Android they are paired to this means that users running phones with an OS as early as jellybean still get messaging style goodness on Android wear all you have to do is these three things in your phone app first you have to use notification compat builder as opposed to notification builder second you have to use notification compat messaging style instead of notification messaging style to be fair these are both things that you're probably already doing because compatibility is pretty important here and then third and you're probably already doing this if you're a messaging app which i mentioned before you need to add the user's chat history as an extra page with wearable extender to continue to support Android wear 1x if you've done these things you're going to end up with the following as shown by these handy tiny little charts first on Android wear 2.0 regardless of what version the phone is running you're gonna get messaging style everything that I showed you full chat experience right in the notification on where 1x paired to any phone you're going to get the standard notification card in the stream and because you added that extra page that's going to show up and your users are still going to get their chat history because messaging style is a bespoke experience on Android wear 2.0 we don't actually show those extra pages finally on the phone if your users running em they're gonna get messaging style notification and if they're not notification compat ensures that they still get the standard notification experience all these things sort of summed up together it mean that if you use messaging style and these two other things that I said you get the best of all worlds no matter what device is paired no matter what version those devices are running so what actual steps do you a developer need to take to work with the chain that we've made in Android wear to toe first you need to make sure that notification in the stream itself is rapidly glanceable basically means focus on the text second to get all this expanded notification goodness and really take full advantage of it use extra content pages with wearable extender to really like you structure those building blocks and build the experience out for your users third this is also pretty important is that notifications as you notice are dark now that means that color spannabis and display intents for your notifications are actually maybe not going to work as well as you would like because you need to support dark backgrounds on 2.0 and light backgrounds on 1x kind of hard to find colors that work on both that said quick call out here if you have a standalone app or a wear app at all all you have to do to make this work is just check the API level at runtime or use a resource qualifier to adjust your colors as necessary you can still use them as normal finally last bit of your a messaging app make sure that you use notification compat and messaging style to give your users an awesome wear experience without having to write the wear app if any of this stuff interests you and it probably should just go to G Co slash where preview and you can get the preview SDK device images and more information about the new API is that we're going to be launching all right fantastic Thank You Alec sighs everybody like still awake because we need to stand up like shake a leg or tell us off anything yeah we've got a few more things that I want to cover here let's switch places so I can poke the computer a few more things we want to talk about and then if we have time I'd love to open it up for for questions let's get through it first I want to draw your attention okay let's make sure the keyboard works so this guy here malala's hair answered the question at Google i/o 2012 when we first introduced rich notifications with jellybean and at the same time he introduced the ability for users to block notifications that they found inappropriate or spammy or what have you and somebody got up at the mic and said excuse me as an app can I find out when the user has blocked my notifications and this guy got up there and said no so actually this is pretty easy to do the initial implementation actually you couldn't do it but when a pops came along which you may know is the foundation of our you know permission system we moved notification blocking over to a pops because hey you know that it's a new system facility for exactly this sort of thing and it turns out that because of some performance optimizations in a pops you can from any app at runtime do some you know funky introspection and just check to see whether an operation is allowed before even invoking it it makes it much faster to do certain kinds of operations so yeah you can find out whether your notifications have been blocked by reflecting in Java so at the time we were really worried that if apps knew when their notifications were being blocked the world would end it's 2016 four years later the world has not ended so we said fine you know what let's just make a real API for this because we think they're actually some legitimate uses of it so I'll get to that in a second you can say notification manager dot our notifications enabled real easy-like are they has the azure block my notifications are not and you don't have to do those ugly hacks and you don't have to go online and and put bad stuff up and the reason that we introduced this in addition to wanting to reduce the number of places that people had to resort to those attacks is that you can't actually create a better experience here's the situation a user it feels like they're not getting notifications from your app and they don't understand why so they go into the app then go into settings they see all the boxes are ticked notifications are turn on I don't know what's wrong one start so now what you can do in your app in your settings this is sort of a mock-up that I use Gmail as a guinea pig here but obviously you can do this in your own app if the user goes in to modify notifications settings your app could go and sell hang on a second are they you you block notifications at the system level like there's nothing we can do until you go and unblock that so you can alert users to those conflicts and I think that's a great user experience if you do use this in some sort of abusive way if you use this API to create some kind of arms race with these are all you block my notifications well I'm gonna use a top-level system alert window or whatever I will come and find you so don't do it let's see other stuff you want to know about if you use builder and if you're not using builder we have to have another conversation because set latest event info doesn't work anymore if using builder we've changed a little bit how the memory works that used to whenever you call build it would construct a new notification object though it's a snapshot of its state and hand that off to you now it actually retains that object internally and just gives you a pointer the big reason for this is that notifications are huge they didn't used to be but now people adding wearable extenders and car extenders and lots of big bitmaps and things like that they're big objects and we didn't want you to have to suffer that in your memory partition every time you construct it up a new notification so when you're using a builder it is holding on to that prototypical sort of embryonic notification and when you call build you just get a pointer to it if you're not expecting that kind of behavior the way things work in EM is going to be possibly a little confusing but this actually will make memory better for you it makes memory better on the system overall this is also important when you are posting updates to notifications we see a lot of people in the field caching their notification object and then using either poking directly into the slots on that POJO or using remote views methods to try to update like progress bars and things like that in the notification you can't do that anymore I mean you can it's not really gonna work because well I'll get to the what happens to those remote views in a second what you want to do if you are posting updates to your notification and you want to keep some memory around as long as your app is still live is hold on to the Builder the builder will hold on to the notification it'll be nice and fast to just go and talk to the Builder and make your changes there and call build again this is a good bully pulpit for me to remind you about features we've introduced over the last couple of years that you may not be using yet since L notifications have been available on the lockscreen on all L Android devices but users have different tolerances for what kind of content is appropriate on the lockscreen lock screen is kind of a public place if they've got you know pin password fingerprint security potentially anybody can you know pick your phone up off a cab seat and and take a look at it so if a user has opted into what we call a you know hide sensitive content notifications on the lock screen your app is your is just really not gonna say anything interesting unless you specifically say oh here's a public version here's a version that's safe for the phone that's found in the backseat of the cab or even just you know laying face-up on your desk when somebody else is sitting in the same room so go ahead and use set public version to supply a version of that notification that's okay for users who are security conscious or if it's something like a weather widget or media playback when you want it to be available at all times say you know what I'm just gonna set the visibility of this notification to public and then it's appropriate anywhere and you don't have to make a separate version for it something else I wanted to mention is the way that Do Not Disturb works so hopefully you've had a chance to play around with the do not disturb that we made really really good in marshmallow the way that it knows what things are phone calls or alarms to allow the user to put the phone into alarms only mode and get those alarms or into priority mode and get phone calls from important people is with your metadata in the Builder and the two big ones are set category and add person set category allows you to say this is an alarm I know I'm not the did the built-in Android alarm clock app or the the OEM is built in an alarm clock app but this is you know I've got this cool app called timely and it's got an alarm and it should be treated as alarm as when the user says go into alarms only mode use that category to mark it that way similarly add person is the way that users are allowed to opt certain human beings in to be able to break through their priority settings and so you say add person and we accept kind of anything that we could use to look that person up in the system contacts database so you can throw yeah if you've got fantastic if you've got a Content you know a Content URI for that person in the contacts database awesome we'll just look it straight up but you can also just supply an email address or phone number and we'll go ahead and look that up in contacts DB particularly if your app doesn't really want to interact with the Android contacts database but it is phone number based you can give us a phone number in the notification we'll look it up if the user has starred that contact that notification can bust through priority mode which is a great feature for users that want to tune out of most things but there are some people that should be able to get a hold of them at any time I just wanna remind you that media style exists that was the new template that we introduced last time around if you are building a music player or anything that kind of like in music players such as you know background control of some sort of like remote playback thing or video player what have you used media style and we'll take care of all the details of making it look good on every platform version and I mentioned earlier there was the decorated custom view style if you feel like you really need a custom remote views there's a decorated media style style I forget what it's called look at the API Doc's I have to as well to be able to get the system annotation of the app name and so forth new actions along with media the other thing that I want to mention specifically about media style is that if you are using set a or if you were worried about using set color which is the notification accent color feature if you were worried about using that because it made your media playback notification look garish it doesn't do that anymore so in n we are only using that color to tint some of the playback controls so it should be a little bit safer to take your media player's brand colors whether it's some live in green or orange or what-have-you and set that as the color on your media style and it should look really good on em this is where we have a very very brief moment of silence for api's that are no longer with us specifically all of the direct access to remote views on notification they're not gonna work because we're not even creating them time was when you created a notification even with the Builder and called build we would generate a whole remote views that looked exactly like that notification was going to appear on the other side and then we would stuff that thing into a parcel and push it all through binder to the system server push it all the system you want yeah we just don't do that anymore the remote views is not very if you have a customer reviews and you said it those slots will be there but if you use the Builder methods these API is content view big content view heads-up content view are not there so use builder dot set content and actually we renamed that method to set custom content view to make it better match the other stuff that's been developed in the meantime all right so this is for like two of you in the room who are using notification listener service one of them is you because that's how we're works if you have a notification listener service one of the things that we noticed after releasing this API 86 years ago is that when we binded them from system UI we've been buying it or bind them from the notification manager we've been binding for the lifetime of the system because we sort of thought of them as an extension of the system UI they are really expensive so now if you have a listener that only needs to listen occasionally like you know it's oh we're only listening when you're in the car or we're only listening when you're on a run we're only listening when you're using this particular app or experience you can say request unbind like the users approved me as a notification listener but I don't need to be bound right now I'll let you know when it's important to bind me again and start sending me notifications so this can really improve performance on the device it can improve memory pressure I think that's all the sundries there's lots and lots of resources online obviously dp3 is out you should go get that apk go get that that package we also have sample code we've updated them to show off oops in the summary is our standard active notification sample and github and then the messaging service update demos remote input I don't know if it demos messaging style yet I think that that is still like still damp with how new it is so it's not a messaging service yet but it will be the wear Doc's do call that out the way Doc's mention it okay so as developers what do test your existing notifications on n definitely if you have lots of notifications that you're already posting and you're not grouping them please PLEASE group them nobody likes to turn on a phone in the morning and get 36 notifications of all the stuff that happened while you're asleep ad direct reply where it's appropriate where you can accept reply text and then if you're using custom notifications do look at that decorated custom view style so users will get the benefit of the app attribution and the expand affordance and now it's clear stuff effects we're just a little bit we're actually holding a lot of sessions today so this is this is a list if you want to come see more starting with the big one what's new in Android wear 2.0 and then a couple of the others that I actually mentioned during my portion of the talk also as you know if you've missed anything all of these talks are going to be available on YouTube kind of shockingly quickly yep and finally the Android wear sandbox you can go to two for more questions in live demos it is the green square on this map it also is just sort of like through this wall and a little bit further though probably go around instead of actually through so we have time maybe for like one or two live questions if you want to get up on the mic and ask otherwise we're going to be outside and there's also we've enabled the new Google spaces app for this talk many of the talks today have spaces associated with them where you can go and communicate with the people in this room and everybody else too I came to i/o to talk about this topic poster examples of your favorite notifications and least favorite notifications but we've got a couple minutes let's go ahead and take some questions from the room yes go ahead the aware of notifications the new style you said you can set the background color of those cards correct using the set color API which is actually what dan talked about with regards to media style specifically calling set color for your notification will tint things on big Android and will also on the littlest of androids can set the background color for all of those parts does it send it directly or just tinted we use a darkened version of it great thanks so there's a practical limit that no package can post more than 50 notifications you shouldn't really be posting that many at all but you can imagine a situation where you've got 5 accounts and you want to have 10 messages that seem as reasonable I don't remember if we actually ended up creating a limit but you'll notice that you'll start to see system performance suffer if you're posting all 50 into that group at the same time not least because it's not useful the users not going to want to triage that much stuff our recommendation is on the order of 5 maybe as many as 10 only your observation of user behavior we'll see will tell you what is actually gonna be useful to people so I don't know what the underlap is between those two between those two api so we should talk we should talk after and and maybe that sounds like the kind of thing that would be good there's a bug tracker specifically dedicated to the Android and previews that's a good place to raise that kind of issue because we are triaging as bugs pretty aggressively and and taking action on them Thanks thank you no there's no there's no broadcast so you can't find out like you know what we really don't want you to do is to try to like min/max the user's behavior and try to respond in real-time to you know when the user becomes you know so enraged with a block notifications it's expressly created so that you can do things like I showed in the screenshot when the user has problems you can say well here that's one of the reasons that you might be having those problems so there's no listener I mean you can check at any time yeah yes it's we're 2.0 availability question so we're 2.0 is going to be available later this fall the to be fair also the Developer Preview is available right now on the site that I linked gqo slash where preview thank you alright I think that's it thank you so much we'll see you on spaces and thank you for throwing up you

2 Replies to “What’s new with Notifications in Android N and Android Wear 2.0 – Google I/O 2016”

Leave a Reply

Your email address will not be published. Required fields are marked *