The Evolution of Notifications
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Title of Series | ||
Number of Parts | 52 | |
Author | ||
License | CC Attribution 3.0 Unported: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor. | |
Identifiers | 10.5446/47732 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | |
Genre |
1
2
3
6
7
12
14
23
24
30
35
40
42
44
46
47
48
51
52
00:00
Core dumpProduct (business)Strategy gamePoint (geometry)ImplementationBitDampingFreewareDecision theoryCore dumpView (database)Process (computing)Android (robot)EvoluteTracing (software)Lecture/Conference
01:00
Electronic visual displayNormal (geometry)View (database)Message passingAreaInformationOrder (biology)RectanglePixelGroup actionCartesian coordinate systemContext awarenessMultiplication signPhysical systemPoint (geometry)Task (computing)AreaGame controllerMessage passingMobile appNormal (geometry)Computer animationJSONXMLUML
02:34
Software developerJava appletObject (grammar)Field (computer science)Logical constantSocial classInheritance (object-oriented programming)Electric currentContent (media)Squeeze theoremGroup actionAndroid (robot)Sinc functionLevel (video gaming)Message passingMedical imaging12 (number)Web pageQuicksortMathematicsRevision controlEmailComputer iconPower (physics)Right angleCategory of beingGroup actionGreatest elementSqueeze theoremMereologyBitPosition operatorInteractive televisionPerspective (visual)Cartesian coordinate systemGoogolComputer animationXMLUML
05:24
Content (media)Group actionInformationCartesian coordinate systemDependent and independent variablesComputer iconSpacetimeGroup actionMathematicsCASE <Informatik>Pattern languageUML
06:25
Content (media)Group actionPower (physics)Slide ruleAndroid (robot)Mathematics
07:00
Software developerGoodness of fitSystem identificationForm (programming)Reading (process)System callMultiplication signTransformation (genetics)Right angleSingle-precision floating-point formatProjective planeEmailComputer animation
08:09
1 (number)Sound effectPattern languageMoment (mathematics)Mobile appSession Initiation ProtocolSoftware developerAndroid (robot)
09:04
Descriptive statisticsJSONXMLUML
09:38
Electronic visual displayInformationInformationCartesian coordinate systemCategory of beingMultiplication signFrame problemGroup actionSound effectMoment (mathematics)Uniqueness quantificationJSONXMLUML
10:31
Abelian categoryMetadataMetadataPhysical systemLimit (category theory)1 (number)Sound effectGroup actionQuicksortAndroid (robot)Category of being
11:13
Android (robot)DampingLatent heatComputer iconProduct (business)TouchscreenPower (physics)Mobile app1 (number)Electronic mailing listCartesian coordinate systemAuthenticationExecution unitComputer animation
12:35
Projective planeProduct (business)Server (computing)Goodness of fitMobile appCartesian coordinate systemCategory of beingInformationVideo gameWave packetGraph (mathematics)TwitterMessage passingInstance (computer science)Multiplication signCASE <Informatik>Line (geometry)PlanningComputer animation
14:06
Video gameGame theoryMultiplication signJSONXMLUML
14:57
Time zoneCategory of beingMessage passingHand fanEmailMultiplication signJSONXMLUML
15:59
Computer-assisted translationPattern languageMultiplication signCASE <Informatik>Level (video gaming)Category of beingClosed setAndroid (robot)MathematicsDigital photographyMobile appJSONXMLUMLComputer animation
17:09
Context awarenessCASE <Informatik>InformationView (database)Point (geometry)Multiplication signCategory of beingElectronic visual displayGraph (mathematics)Sound effectEvent horizonRight angleSystem identificationJSONXMLUML
17:47
Musical ensembleArithmetic meanCategory of beingAndroid (robot)Event horizonMappingVideo gameSystem callBitOrder (biology)Multiplication sign
18:38
CASE <Informatik>Computer clusterWave packetBitLine (geometry)Message passingComputing platformWorkstation <Musikinstrument>Electronic visual displayInformationSuite (music)Charge carrierMultiplication signRight angleMobile appWhiteboard
21:17
InformationAndroid (robot)Wave packetWord
21:47
Motif (narrative)Event horizonContext awarenessMilitary operationPhysical systemGoodness of fitMereologyCASE <Informatik>Data managementSinc functionMultiplication signType theorySet (mathematics)Broadcasting (networking)InformationMathematicsPhysical systemEvent horizonMoment (mathematics)Sound effectOcean currentGoogolError messageContent (media)Android (robot)Category of beingContext awarenessOperator (mathematics)Local ringRight angleNavigationReal-time operating systemTwitterService (economics)BootingAsynchronous Transfer ModeComputer iconLogic gateFilm editingComputer animation
24:36
Context awarenessObject (grammar)Game theoryTerm (mathematics)FlagCategory of beingSocial classContext awarenessPoint (geometry)MereologyCASE <Informatik>Instance (computer science)Connectivity (graph theory)Group actionType theoryXMLUML
26:11
Code refactoringBootingMobile appData managementCode refactoringMoment (mathematics)Software bugWave packetRight angleCartesian coordinate systemRing (mathematics)Inversion (music)Point (geometry)RhombusGradient
28:08
Local GroupMessage passingMobile appMultiplication signFront and back endsDependent and independent variablesLogicTablet computerFrame problemRight angleProduct (business)Software bugReal-time operating systemSoftware developerJSONXMLUML
29:24
CASE <Informatik>Multiplication signAndroid (robot)GoogolWorkstation <Musikinstrument>Data managementMoment (mathematics)Right angleSystem identification
30:05
HypermediaBitEmailHypermediaCASE <Informatik>Instance (computer science)Module (mathematics)Computer animationDiagramXML
30:42
TouchscreenWordGoogolView (database)Process (computing)HypermediaReflexive spacePhysical systemRemote procedure callRight angleView (database)Latent heatCodeDirection (geometry)CASE <Informatik>Process (computing)Multiplication signXMLJSONUML
32:13
Software developerDistribution (mathematics)View (database)Android (robot)Standard deviationParameter (computer programming)Default (computer science)Information securitySet (mathematics)Content (media)WebsiteTelecommunicationSimulationInstance (computer science)Physical systemMultiplication signSoftware developerDefault (computer science)Power (physics)View (database)Android (robot)JSONXMLUML
33:16
MereologyDefault (computer science)2 (number)View (database)CASE <Informatik>Instance (computer science)
33:51
Graph coloringArithmetic meanSequenceString (computer science)Keyboard shortcutAlpha (investment)GUI widgetMultiplication signGoogolView (database)outputClique-widthJSONXML
34:59
Electronic visual displayEmailInsertion lossGroup actionInformationDataflowMobile appCartesian coordinate systemComputer programmingArithmetic meanMedical imagingSmoothing2 (number)Instance (computer science)JSONXMLUML
36:04
System callOvalEvent horizonImplementationInteractive televisionMoment (mathematics)MetadataComputer animationJSONXMLUML
36:36
Interrupt <Informatik>Digital filterUser interfaceRepresentation (politics)Public key certificateInternet service providerWeightInformationAndroid (robot)String (computer science)Computer animation
37:07
MultiplicationSynchronizationTablet computerCASE <Informatik>Multiplication signDirected graphSynchronizationAndroid (robot)Arithmetic meanMobile appPhysical systemLie groupEvent horizonTerm (mathematics)JSONXMLUMLComputer animation
Transcript: English(auto-generated)
00:00
I'm going to talk about the evolution of Android notification. First, we'll approach it from the UI point of view. Then we'll discuss some UX and product decision we have to make around notification. And finally, we'll see a little bit of implementation strategy in API you could use.
00:21
A little bit more about myself. I recently started a new startup called Trace BK. And our main goal is to recreate a bank from SME from scratch. To give you more details, as I say, it will be specifically designed for SME. And we'll try to do the banker job how it should be done.
00:41
That is to say, we'll try to help the customer rather than selling him products he doesn't really need. We'll start from scratch, so no legacy, which is one of the main problem in the banking industry right now. And finally, we'll always try to defend our three core values, trust, technology, and ethics. And if you're interested,
01:02
notice that you reach to me after the talk and you can find all the info online. Back to the talk, let's start with what is a notification. So to be very clear today, we are only gonna talk about this pixel rectangle that appears in the drawer, and only that.
01:20
And if we look at the definition in the documentation, we can see that a notification is a message you can display to the user outside of your application's normal UI. Both the notification area and the notification drawer are system control areas that the user can view at any time. And on this definition, I want really to focus on two main points. The first one is outside of your application,
01:42
and the second one is can view at any time. That's really important because that's really where a notification brings the more value. It brings two core value, I would say. The first one is what we call awareness. It means it will allow you to make your app visible outside of your application,
02:02
and you will be able to remind users that you exist. Don't forget about me. I can help you with your tasks today. The second one is quick access. So basically, your user will be able to have actions without having to trigger your app, which is really great.
02:21
So quick access means quick actions, and also shortcuts. So it will make them save times and save clicks, so it will just improve the user experience. Okay, now that we defined notification, let's see some history. So first of all, notification has been introduced in Android
02:42
since API level one, actually. So it's almost 10 years now, and I found this gorgeous gem, I'd say, at the 12th page of Google image. So as we can see, at the beginning of Android, it was really thought for text messages,
03:01
and if we jump directly to Gingerbread, we can see that it's still very simple, and it's still thought for text messages or emails. So a little bit of 50 shell of gray on the UI part. Then, if we jump to Ice Cream Sandwich, we bring the Holo theme, and we can see
03:22
that Google figured out that notification could be much richer. They provided, we could use a big image. Here is a icon. And we can also, sorry about that, and we can also add subtext.
03:40
Then with Jelly Bean, nothing changed from the design perspective, but Google added the new notion called actions. So this is the label and the action. It's very simple, but it's very powerful. Before that, we could only have only one action per notification, and right now, we'll be able to really build
04:01
richer notifications that will be really easy to master, and user will really take power over it. In this version, they also introduced a notion of priority. We'll go into more detail, but we'll see that being able to sort the notification in the drawer, having the best notification at the top
04:21
is really important. Then KitKat, no change, so let's continue. And we arrive at Lollipop. So, Lollipop, welcome to Material Design. It's wide background, and you can see that a lot of change, and what I want to focus on is that the icon of the applications
04:43
that triggers the notification, here it's a droid, change again of position. First, it was on the top left at the beginning, then it went at the bottom right, and now it's close to the top left. In this version, they also added the category,
05:01
once again, to help prioritizing the notification in the drawer, and they also added the possibility to group the notification by providing a summary. Then Marshmallow, once again, no change, let's continue. And we arrive at Nougat.
05:20
And as you can see, Nougat changed almost everything. So, you will run the animation, you will see that, okay, everything changed, basically. The notification has more space, it's clearer, I would say, and I feel it's more Material Design. But, as you can see, they change again the notification, the application responsible
05:40
for the notification, here at the icon, and they added it at the top left corner. It's really important because we can see that in Western Europe or in America, most of people start reading by the top left. And it's really important because when you start reading by the top left, it means that the most important information is probably at the top left.
06:01
And in that case, that's the application that triggers the notification. So, it's really important to be able to identify the application that triggers the notification. And they also deleted the action icon, so it was a cross, to have more space available for action, giving in, yeah, action is really a huge
06:20
pattern and is really important for notification. And now comes Android Oreo, so when I started writing this slide, Oreo was not hard. Now that it is, I integrated some slide to explain what it changed. On the UI change, nothing, so we can see that Google changed the UI layout every two years,
06:42
let's see next year, and they added an important notion that we will see later, is channels. It's really important because it will give more power to the user to be able to fine-tuning the notification experience he has.
07:00
But before implementing a notification, developer must realize that creating a notification is a topic that must be very well thought. Why is it important, you may ask, to become a good citizen about notification on Android? Well, it's pretty simple. Humans have a form of notification since a long time.
07:23
If you think about it, letters was a form of notification, right? Telegram was too, phone calls are still a form of notification, SMS, emails, and even Batman as a form of notification with this project, all right?
07:41
And the thing is, all this notification form transform day by day into spam. We receive a lot of spam in our mailbox, we receive a lot of phone calls or SMS that are still spam, emails as the spam folder that we never look at it.
08:00
And even Batman, I'm pretty sure, is a bit tired of having to save the world every single night. So, yeah, that's really important to not become a spam. And if we are not careful, if every developer is not careful about it, Android notification will become a spam also.
08:22
What we must realize is a user has probably, I don't know, 60 or 50 apps installed on his phone. If all the apps trigger notification around the same moment, he will get 50 notifications, and no one can reach through 50 notifications. It's impossible. And this is where the spam effect will come from.
08:44
So your notification may not be a spam, but it will contribute to the spam effect. So before implementing a notification, you must be very careful about, is it a good idea, does it solve the problem, is it a good pattern to match what I really want to do?
09:03
If you don't, it can create several problems. The first one is description. I think we all encounter the situation where we say, okay, I will stay away from my phone, it cannot stop vibrating, okay, I need to focus on my work. And this is not normal, actually.
09:23
This shows that there is a problem in behavior. We should be able to have our experience, always have our phone with us, without having to, okay, there is too many notifications. Then there is also this famous clear all button
09:42
that I think you know about it. As I said, if we all trigger our notifications, you have 50 of them, then user will probably clear all the notification. And if, I don't know, you lie about the category and your notification is not really sorted at the top,
10:02
user might lose this information and never known about. The information is important, but he lost it because it was the spam effect. And finally, the other problem I have is bad timing. If you trigger the notification not at the right moment, the user will probably swipe it and say,
10:23
okay, I will do it later, and he can't forget. So this is a huge problem that some application had, have, and that I had. So to solve this problem, there are several stuff that we can do. The first one is we can try to reduce the amount of notification,
10:40
mainly by grouping them thanks to the group feature to avoid or at least limit the spam effect. We can also use priorities, categories, to help the system sort out the notification and show the most important ones first.
11:00
Then you can also add metadata to your notification. I will show an example later, but you can enrich your notification with metadata that will help the system know it's important. And finally, with Android O, they added this notion of importance. So they deprecated priority, basically,
11:22
and they said, okay, now it's important. So they needed a new notion to start from scratch. And finally, still on the same frame, they added the channel, as I said earlier. So a channel is mandatory in Android O, so a notification cannot be triggered if you don't have a channel associated with it. And it's basically two main screens.
11:42
The first one is you can have access to all the channels of your application, and they are really great features. So you have the list here, and you can say, okay, I don't want to see any notification from this app. So user will be able to say, okay, this app is bad. It's guilty.
12:00
I remove the notification from there. And then if you click on a channel, you get to the second screen. And in this screen, you can see that you can also block all the notification from a specific channel. So if you have a channel that is dedicated to marketing and one is dedicated to more product notification,
12:21
you can say, okay, I don't want to see the marketing ones. You can also, the user can also say, okay, I don't want it to start. I don't want it to vibrate. I don't want the bad icon. Yes, the power to change everything, basically. So now that we have seen good practices on notification,
12:40
another aspect I want to focus on today when designing your product and based on notification is how can I help Android make sure that my notification is a good one? And an easy solution is to categorize them. So as an example, we'll project the role you took on this graph.
13:04
The first axis is how painful is your notification? The second one is how urgent is the information you need to provide to the user? So I took some app. You probably all knows. And we'll enter category by category.
13:20
So the first category is urgent and fun. It's usually a good case for notification. We'll find the agenda app saying, okay, this is your best friend's birthday. There is Trainline, which is a train app to say, okay, your next holiday is planned.
13:42
You can go. A text message, for instance, from your wife or a WhatsApp discussion with your friend. And something that it's really important in this category is 99% of the time, a notification that's urgent and fun for the user
14:00
is a notification that is related to someone that is close to him. So that's why this category is called VIP of your life. It means that if that's someone that is important for you, the notification will be important for you. Then you have what is fun but non-urgent. Here we'll find the news, TV shows, games,
14:26
and we also have social networks. Sorry, and here we go. Yeah, and we also have, as I say, social networks. And as you may notice, I put Snapchat first on the chart
14:40
because actually, even if this is a social network, they created this urgency by their concept. So they'll say, okay, my notification is really important because the user has a little time to see it. So I call this procrastination,
15:00
which means non-urgent but fun. Then there is this category which is urgent and painful. Here we find the low battery. Your bank account, this is actually bank in France, bank account saying, okay, you are going bankruptcy, do something, or your calendar notification
15:22
which wish you, yeah, don't forget to do this. You don't want to do this, but don't forget. Yeah, and this is notification you really need to act quickly about it. Plug your phone, pay your rent, I don't know, but that's this kind of thing that you need to act quickly.
15:43
So I also added the fun Friday night email from work or the famous add channel Slack message from another time zone. This is the kind of thing that you say, okay, I don't want to read this, but I need to read. I need it. I call this livelihood, so yeah, it's urgent,
16:03
it's painful, but you got to do it. And finally, the last category is painful and urgent. And to be really honest, I think that if you feel that you are in this case or close to this case, most of the time, a notification is not a good solution. It's not a good pattern.
16:20
So as example, I added this Android upgrade notification. Nobody's got time for this. The morning apps upgrade, you got every morning. At least who really cares? I don't read it, to be honest. I also did a map notification that keep asking you,
16:42
take a picture, post it. I mean, I'm with my friend, I have other things to do, sorry. Oh, there is Google Photos that always push me to make a montage about my cat with the tent picture I took yesterday. So yeah, that's not something I want to do. That's something, when I trigger the app, I want to remind them saying, okay, I could do that.
17:03
That's nice. But that's not something I need to know right now, right? There is no urgency about it. So I call this category nagging. So to be honest, yeah, it's really justify from the user experience point of view to the notification in that case. So from this graph, we can extract two main principle
17:22
to evaluate notification. As I said, the first one is be relevant. Is your information is up-to-date? Is it important to use there? The second one is be legitimate. You don't want to lie about urgency. You want to have the notification display as the exact right time the user need it. It can be tricky, but that's such a war effect.
17:43
Like, okay, this is exactly what I needed. And to help categorizing notification, Google enforce in Android O an order. It's official now. It's not a secret sauce. The first one are all the major ongoing event.
18:01
So you will see the travel with maps, music playing, phone calls. This is the thing that you are currently doing, so they are first. Then you have this category people-to-people that is finally the VIP of your life, meaning that's what important for you, the people that are close to you.
18:22
Then you have the general, where you can find everything, and you have the by the way. To be honest, once again, if you're in the by the way, probably your notification is not a good reason. Probably someone pushed you to do it. Just most of the time, by the way, not a good idea. To illustrate a little bit what I said,
18:41
I will take a use case. So as I said, I'm currently working at Trust BK, but before that I was working at a startup called Captain Train. We have been acquired by Trainline, and I left Trainline now. But this is what I work on, so that's why I took it as an example.
19:01
So let's see what we did with our notification experience. So does anyone know what Trainline is, or Captain Train? Not so much? Okay, so basically we sell train ticket online. So we try to provide the best user experience possible when you want to buy your ticket.
19:21
But it doesn't stop here. We also want to be with you during your travel. So we try to be with you when you need it and to provide information that could help you during your travel. So it's by train. So most of the people here, I guess, are German, so they probably know about train.
19:41
And when you need to board the train, at least in France, you need a reservation and you need to arrive 20 minutes before you travel at the station. So when you arrive at the station, all you need to know is which platform I should go, which carrier I'm on, and which seat I sit. And in fact, this is exactly what we try to provide
20:04
here as a summary. So you add all the information you need without opening the app. Then once, so we are both legitimate and relevant, right? But then the train leaves the station,
20:21
we will remove the old notification, and we'll add a new notification answering the famous question, when do we arrive? And once again, we try to be as relevant as possible, so we'll try to retrieve real-time data to make sure that the data displayed in the station is always up to date.
20:42
And then once you arrived, we remove this notification and we'll display notification, which is have a great day, with the next message. The thing is, we display this notification only for 15 minutes after our arrival. The main reason for that is because we are neither legitimate, neither relevant.
21:03
But it was a good way, he couldn't really, we could totally remove this notification, to be honest, but it was a good way to interact with our user and having some fun. So, but you need to have some fun, but not too much, so 15 minutes was okay for us. And finally, if I had to implement it now on Android O,
21:21
this would be probably in another channel. It's not during the travel, it's before the travel. When your train is canceled, you want to have the information as soon as possible, because you need, you will have to change your train, cancel your trip, this kind of thing, so this implies some stuff you really need to do now.
21:42
So that's why it's another channel and it's not scheduled as the other one. Well, okay, now we are sure that we have a good notification, we have good use case, we know the UI, let's trigger it. So trigger is the simple part.
22:03
You create a new notification. The only three information required, mandatory, are small icon, content title, and content text. This is not entirely true, since Android O, you also need to provide the channel ID. You will use the notification compact,
22:20
and as it was illustrated, I think, at the beginning of the talk, the notification really changed over time, so Google provided a compact stuff to help you handling the change of API. And then you can notify it with notification manager compact, and you'll notify it with an ID and a notification.
22:41
But there are several type of triggering. The first one is local event. So local events, most of the time, you are just reacting to a click. Download this, update this, posting a tweet, this kind of thing. The second one is really much more interesting.
23:01
It's based on the alarm manager, and as I said, being able to provide the right information at the right moment is really a war effect for a user. So you can count on the alarm manager for that. So alarm manager is a system service, so you get it by the context, and then you do a set exact with a type,
23:22
a trigger at minutes, and an operation. Well, it's not that easy. Since Google didn't provide the compact, but it changed over the API, when you have Marshmallow, what you want to do is do a set exact and allow while idle to make sure you wake up the device,
23:40
even if it's in those mode. Then if you have KitKat, you will do the set exact, and if you are before KitKat, you do the set. So this is something you have to write yourself. Then you have the type. So there are two main category of types. The first one is linked to system current time release, which is the time since boot, including sleep,
24:02
and there is a system clock.lpc real time, which is a wall clock time in the UTC. Then there is a trigger at Melis, which is along in Melis Gantt. The thing is, you have to be sure that it match the type you choose.
24:22
And then there is this operation, which is a pending intent. It has a simple MP, right? Get activity, get service, get broadcast. And I want to focus on pending intent because I see a lot of error about it, and I think it's really an interesting use case. First, is it that simple? Let's play a game.
24:42
Do you think that these two pending intents are equals? So you have an intent, which point to a main activity, and then you create two pending intents, one with a context, an ID, the same instance in both case, and the same flag. Are they equals?
25:01
Yes, no? Yes, yes they are. If you change the ID, I know we have one, two, three, four, and one, two, three, five. No, it's not equals. And if we don't have the same instance now,
25:21
it's just two intents that point to the same activity. It's equals, yes. And now if I add extra, extra one, and extra two, is it equals? That's the trick, it's equals. In fact, the extra is not part of the equals of an intent. And that's where we'll see some problems
25:41
that will arrive later. If we have two categories, do you think it's equals? So it's two different categories. It's not equals. And in fact, you just have to look at the filter equals on the intent class, and we'll see that the action, the data, the type, the package, the component, and the categories
26:01
are part of the equals, but not the extra. And then because of that, it can be trickier. What we need to know is that a pending intent will survive app upgrade. It also survives reboot, but it also survives app upgrade. So let's take this example. You release your app in end version,
26:22
then you register a pending intent in the alarm manager. The pending intent is really simple. It points to an intent which is, it points to main activity with an extra which is extra one. Then you do some huge refactoring in your app because you need to work, and you change the extra one in extra two because yeah, it was bad naming for whatever other reason.
26:44
Then you release your app in plus one. And then the alarm manager triggers the intent, right? Because you register in 10 days, it triggers the alarm. And then you have this, then what it triggers? It triggers the pending intent the first one you did, right?
27:02
With extra one. And you have this NP, and you say, okay, there is a premise Android, it cannot happen. And that's true, in fact. If you look at the N plus one application, it cannot happen. You register the good pending intent for the right activity with the right extra.
27:22
But since the pending intent survives app upgrade, you still have the old one with extra one. When you look at the extra two, it's empty, and then you crash. It means that when you add pending intents, it must be considered as an external API.
27:41
Let's say, okay, we need to cancel all the pending intents before and register them again in the alarm manager. That is the kind of stuff we add, and we added some bugs with this at Captain Train because we are using the alarm manager to trigger at the right moment for porting the train. And if we weren't careful about it,
28:03
we had a lot of crash, which is really tricky to understand. Finally, the last triggering is real time. So GCM or Firebase, I will not go into much detail, but as a piece of advice, the first one is use extensively the group,
28:20
because if you trigger a notification every time you have a new message and the backend has a bug, I don't know why, you will get a lot of notification, a lot of message. If you have a logic inside new apps that you can group them and say, okay, here's a summary or discard the last one, it will be really better. Then we have this be careful about marketing abuse.
28:42
I mean, I'm speaking to developers, so you probably already know, but when you open the door, everything enters. So we really need to be careful about it because as a developer, I feel I have the responsibility for my product, so that's something I care about. And finally, don't forget to remove notification,
29:02
especially with GCM, because that's the kind of problem I have. I have a tablet that I use maybe once a month, but when I use it, when I turn it on, basically I get 100 message that the backend never cancel, and it's really bad because I clear all, and maybe in this clear all, there is a good notification.
29:24
To help us with this kind of problem and triggering, Google added two feature in Android O, Oreo, sorry, I'm not used to, the first one is snooze, which is great, it doesn't prevent you to register at the right time with the alarm manager, but it can help.
29:41
If your user is busy, you can just swipe it and say, okay, I want to see that in 15 minutes, I would have time for this at this moment. And finally, there is this time out, which is really great because you can remove automatically the notification for you, which is, for instance, really helpful in our case when we want the last notification when we arrive at the station to last for 15 minutes,
30:03
we could just use the time out in that case. Okay, so now a little bit of styling. Styling is pretty easy, actually. We have this full style, which is called notification.style, and we have other styles that are,
30:20
let's say, important use case, big picture style, inbox style, big text style, messaging style, and media style. And if we look at the documentation of material design, it's pretty easy, actually. It looks exactly like you have on your phone, I guess. The big text, you can expand it and have the body of the email, for instance,
30:42
big picture for a screenshot, you expand it, you have the full picture, and even the media as their own layout because you want the user to have good reflexes when you're on the media player, so you want to retrieve the same button and the same experience. If you don't find what you are looking for
31:01
as a layout in this, you can use decorated custom view style. Decorated custom view style is great because you can provide your custom view, but you will still keep the decorated items of a notification, the headers, the actions, so it means you can still have the layout of the system, of the guidelines,
31:21
and just provide a custom notification. If you really, really need to do something particular specific at your use case, you can use remote views. Does everyone know what is remote views?
31:42
Yeah, not so much? Okay, a remote view is basically the view. It's encapsulated view, but your notification will run in the system UI process, right? So if your code is run in this process, it means you have all the permission and all the privileges of the system UI process, and this is not possible.
32:01
So they encapsulate your views in remote views, and these remote views make sure that it's safe and that you are not accessing something you don't have the right to do. So it's a simple security layer, and you can use it with the set content on the notificationcompat.builder.
32:23
But as a piece of advice, I would say, avoid remote views as much as possible, because as we saw at the beginning of this talk, the notification layout really changed over time. So if you start by doing something custom, you will need to do something custom for Noongar,
32:41
for Lollipop, and for the Ollosim with KitKat, for instance. So, I mean, it's not impossible, but the system is already doing it for you. So I would, yeah, it would be better to use the default styling or the span. So span is probably start to be well-known
33:03
about Android developers. It's a very powerful API, it's available everywhere. And you can really create rich text really easily. The thing is, it's a good, I have a good example here again.
33:21
In that case, for instance, we could totally do one text view, a second text view, and a third text view. And it would work, we'd provide a custom view, and it would be good. The thing is, you don't want to do that. If you can rely on the style of the default style,
33:40
you want to do it. So in that case, you can provide the spanable, and we will be able to strike through and disable the part of the text we want. And it's actually really, really simple to do it. First, you create a spanable string. Then you add it to span, so a strike through span, which goes from zero to the end,
34:02
and which is both inclusive, inclusive, meaning that you take all the characters. You do exactly the same thing for foreground color spans. That will be the color of the text with an alpha, which make it looks a bit disabled. And finally, you just set it on the text view, or you just provide it to your notification,
34:22
and that's it. So instead of having three text views, you just have one views. And yeah, spanable are really great, because they are available everywhere. If you have a chart sequence as an input, it means that you can put a spanable in this. So it match for the shortcuts,
34:41
the new API I did last year, for notification, for widgets, I don't know, for everything. Okay, so we still have some time, so I will go through some other tips I could provide. The first one is, don't forget that a notification is transient,
35:03
meaning that if your user lose it, it needs to be able to find the same information somewhere in your app. It may look silly, but sometimes I find applications where the information is only available in the notification, and I can't find it anywhere else in the app.
35:21
Second one has been repeated over and over, but it's be patient, meaning if you want user to see a notification that goes through, that display an image, for instance, wait for downloading the image before showing the notification. You don't want the user to click, you have to wait, you want a smooth transition and a smooth flow.
35:46
Also, there is this cleanup program. For instance, if you are looking at your mail, you have notification for your mail, but you go through your mail through the app and you look at an email details, right? What you want, you want to delete the notification.
36:04
And for this, activity has a write method, which is on user interaction. It will allow use to be called when the user has interacted with your activity. A scroll, a click, whatever. And at this moment, we can consider
36:21
that this notification has been seen. The other one is not so much known. It was about the metadata, remember I talked about earlier? On Android, on the notification, you have this method called add person that has been added in Lollipop.
36:43
And actually, you can provide a string URI that points to a contact of your phone. And if this contact is marked as VIP, the notification will be at the top of the drawer. So there is other method like this,
37:00
but you can provide information thanks to this, and the Android will use it to sort out the notification. And finally, there is this method called, sorry, there is this syncs muti devices, which is really important. You want to synchronize notification.
37:21
If I read it on the where, I want it removed on the phone. If I read on the phone, maybe I don't need it on the tablet. It depends on the use case, but most of the time, that's something that should not be quickly solved. Okay, so now we are at the conclusion, and as a takeaway, I would say that,
37:41
first, be a good citizen. As I said, Android will be greater because of this. Don't rely on legitimacy and urgency. It's really important that user can trust you. When you say that this is urgent, they want to rely on you. Be relevant, meaning that that's something really important.
38:04
Don't be a spam. Know your API. Really, there are a lot of APIs that are not so well known among Android community, and that are really great, which are really powerful. And finally, try to follow system guidelines
38:21
as much as possible. On the long term, it will be a huge save for your app. Okay, that's all for me. Thank you.