• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Notifications
2@jd:body
3
4<p>The notification system allows your app to keep the user informed about important events, such as
5new messages in a chat app or a calendar event.</p>
6<p>To create an app that feels streamlined, pleasant, and respectful, it is important to design your
7notifications carefully. Notifications embody your app's voice, and contribute to your app's
8personality. Unwanted or unimportant notifications can annoy the user, so use them judiciously.</p>
9<h4>When to display a notification</h4>
10<p>To create an application that people love, it's important to recognize that the user's attention and
11focus is a resource that must be protected. To use an analogy that might resonate with software
12developers, the user is not a method that can be invoked to return a value.  The user's focus is a
13resource more akin to a thread, and creating a notification momentarily blocks the user thread as
14they process and then dismiss the interruptive notification.</p>
15<p>Android's notification system has been designed to quickly inform users of events while they focus
16on a task, but it is nonetheless still important to be conscientious when deciding to create a
17notification.</p>
18<p>While well behaved apps generally only speak when spoken to, there are some limited cases where an
19app actually should interrupt the user with an unprompted notification.</p>
20<p>Notifications should be used primarily for <strong>time sensitive events</strong>, and especially if these
21synchronous events <strong>involve other people</strong>. For instance, an incoming chat is a real time and
22synchronous form of communication: there is another user actively waiting on you to respond.
23Calendar events are another good example of when to use a notification and grab the user's
24attention, because the event is imminent, and calendar events often involve other people.</p>
25
26<img src="{@docRoot}design/media/notifications_pattern_real_time_people.png">
27
28<div class="vspace size-2">&nbsp;</div>
29
30<div class="layout-content-row">
31  <div class="layout-content-col span-7">
32
33<h4>When not to display a notification</h4>
34<p>There are however many other cases where notifications should not be used:</p>
35<ul>
36<li>
37<p>Don't notify the user of information that is not directed specifically at them, or information
38that is not truly time sensitive.  For instance the asynchronous and undirected updates flowing
39through a social network do not warrant a real time interruption.</p>
40</li>
41<li>
42<p>Don't create a notification if the relevant new information is currently on screen. Instead, use
43the UI of the application itself to notify the user of new information directly in context. For
44instance, a chat application should not create system notifications while the user is actively
45chatting with another user.</p>
46</li>
47<li>
48<p>Don't interrupt the user for low level technical operations, like saving or syncing information,
49or updating an application, if it is possible for the system to simply take care of itself without
50involving the user.</p>
51</li>
52<li>
53<p>Don't interrupt the user to inform them of an error if it is possible for the application to
54quickly recover from the error on its own without the user taking any action.</p>
55</li>
56<li>
57<p>Don't use notifications for services that the user cannot manually start or stop.</p>
58</li>
59<li>
60<p>Don't create superfluous notifications just to get your brand in front of users. Such
61notifications will only frustrate and likely alienate your audience. The best way to provide the
62user with a small amount of updated information and to keep them engaged with your application is to
63develop a widget that they can choose to place on their home screen.</p>
64</li>
65</ul>
66
67  </div>
68  <div class="layout-content-col span-6">
69
70    <img src="{@docRoot}design/media/notifications_pattern_social_fail.png">
71
72  </div>
73</div>
74
75<h2 id="design-guidelines">Design Guidelines</h2>
76
77<div class="layout-content-row">
78  <div class="layout-content-col span-6">
79
80    <img src="{@docRoot}design/media/notifications_pattern_anatomy.png">
81
82  </div>
83  <div class="layout-content-col span-6">
84
85<h4>Make it personal</h4>
86<p>For notifications of items sent by another user (such as a message or status update), include that
87person's image.</p>
88<p>Remember to include the app icon as a secondary icon in the notification, so that the user can
89still identify which app posted it.</p>
90
91  </div>
92</div>
93
94<h4>Navigate to the right place</h4>
95<p>When the user touches a notification, be open your app to the place where the user can consume and
96act upon the data referenced in the notification. In most cases this will be the detail view of a
97single data item (e.g. a message), but it might also be a summary view if the notification is
98stacked (see <em>Stacked notifications</em> below) and references multiple items. If in any of those cases
99the user is taken to a hierarchy level below your app's top-level, insert navigation into your app's
100back stack to allow them to navigate to your app's top level using the system back key. For more
101information, see the chapter on <em>System-to-app navigation</em> in the
102<a href="{@docRoot}design/patterns/navigation.html">Navigation</a> design pattern.</p>
103<h4>Timestamps for time sensitive events</h4>
104<p>By default, standard Android notifications include a timestamp in the upper right corner. Consider
105whether the timestamp is valuable in the context of your notification. If the timestamp is not
106valuable, consider if the event is important enough to warrant grabbing the user's attention with a
107notification. If the notification is important enough, decide if you would like to opt out of
108displaying the timestamp.</p>
109<p>Include a timestamp if the user likely needs to know how long ago the notification occurred. Good
110candidates for timestamps include communication notifications (email, messaging, chat, voicemail)
111where the user may need the timestamp information to understand the context of a message or to
112tailor a response.</p>
113<h4>Stack your notifications</h4>
114<p>If your app creates a notification while another of the same type is still pending, avoid creating
115an altogether new notification object. Instead, stack the notification.</p>
116<p>A stacked notification builds a summary description and allows the user to understand how many
117notifications of a particular kind are pending.</p>
118<p><strong>Don't</strong>:</p>
119
120<img src="{@docRoot}design/media/notifications_pattern_additional_fail.png">
121
122<p><strong>Do</strong>:</p>
123
124<img src="{@docRoot}design/media/notifications_pattern_additional_win.png">
125
126<p>If you keep the summary and detail information on different screens, a stacked notification may need
127to open to a different place in the app than a single notification.</p>
128<p>For example, a single email notification should always open to the content of the email, whereas a
129stacked email notification opens to the Inbox view.</p>
130<h4>Clean up after yourself</h4>
131<p>Just like calendar events, some notifications alert the user to an event that happens at a
132particular point in time. After that moment has passed, the notification is likely not important to
133the user anymore, and you should consider removing it automatically.  The same is true for active
134chat conversations or voicemail messages the user has listened to, users should not have to manually
135dismiss notifications independently from taking action on them.</p>
136
137<div class="vspace size-1">&nbsp;</div>
138
139<div class="layout-content-row">
140  <div class="layout-content-col span-7">
141
142<h4>Provide a peek into your notification</h4>
143<p>You can provide a short preview of your notification's content by providing optional ticker text.
144The ticker text is shown for a short amount of time when the notification enters the system and then
145hides automatically.</p>
146
147  </div>
148  <div class="layout-content-col span-6">
149
150    <img src="{@docRoot}design/media/notifications_pattern_phone_ticker.png">
151
152  </div>
153</div>
154
155<h4>Make notifications optional</h4>
156<p>Users should always be in control of notifications. Allow the user to silence the notifications from
157your app by adding a notification settings item to your application settings.</p>
158<h4>Use distinct icons</h4>
159<p>By glancing at the notification area, the user should be able to discern what notification types are
160currently pending.</p>
161<p><strong>Do</strong>:</p>
162<ul>
163<li>Look at the notification icons the Android apps already provide and create notification icons for
164  your app that are sufficiently distinct in appearance.</li>
165</ul>
166<p><strong>Don't</strong>:</p>
167<ul>
168<li>Use color to distinguish your app from others. Notification icons should generally be monochrome.</li>
169</ul>
170
171<h2 id="interacting-with-notifications">Interacting With Notifications</h2>
172
173<div class="layout-content-row">
174  <div class="layout-content-col span-6">
175
176    <img src="{@docRoot}design/media/notifications_pattern_phone_icons.png">
177
178  </div>
179  <div class="layout-content-col span-6">
180
181<p>Notifications are indicated by icons in the notification area and can be accessed by opening the
182notification drawer.</p>
183<p>Inside the drawer, notifications are chronologically sorted with the latest one on top. Touching a
184notification opens the associated app to detailed content matching the notification. Swiping left or
185right on a notification removes it from the drawer.</p>
186
187  </div>
188</div>
189
190<div class="layout-content-row">
191  <div class="layout-content-col span-6">
192
193<p>On tablets, the notification area is integrated with the system bar at the bottom of the screen. The
194notification drawer is opened by touching anywhere inside the notification area.</p>
195
196  </div>
197  <div class="layout-content-col span-6">
198
199    <img src="{@docRoot}design/media/notifications_pattern_tablet.png">
200
201  </div>
202</div>
203
204<div class="layout-content-row">
205  <div class="layout-content-col span-6">
206
207    <img src="{@docRoot}design/media/notifications_pattern_ongoing_music.png">
208
209  </div>
210  <div class="layout-content-col span-6">
211
212<h4>Ongoing notifications</h4>
213<p>Ongoing notifications keep users informed about an ongoing process in the background. For example,
214music players announce the currently playing track in the notification system and continue to do so
215until the user stops the playback. They can also be used to show the user feedback for longer tasks
216like downloading a file, or encoding a video. Ongoing notifications cannot be manually removed from
217the notification drawer.</p>
218
219  </div>
220</div>
221
222<div class="layout-content-row">
223  <div class="layout-content-col span-12">
224
225<h4>Dialogs and toasts are for feedback not notification</h4>
226<p>Your app should not create a dialog or toast if it is not currently on screen. Dialogs and Toasts
227should only be displayed as the immediate response to the user taking an action inside of your app.
228For instance, dialogs can be used to confirm that the user understands the severity of an action,
229and toasts can echo back that an action has been successfully taken.</p>
230
231  </div>
232</div>
233
234<div class="vspace size-1">&nbsp;</div>
235
236<img src="{@docRoot}design/media/notifications_pattern_dialog_toast.png">
237