blob: acec306472630b965a644e831e7aa66521c0dd6e [file] [log] [blame]
Roman Nurik73790462011-12-22 16:18:19 -08001<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5 <title>
6
7Android Design - Notifications
8 </title>
9 <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
10 <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic">
11 <link rel="stylesheet" href="../static/yui-3.3.0-reset-min.css">
12 <link rel="stylesheet" href="../static/default.css">
13
14 </head>
15 <body>
16
17 <div id="page-container">
18
19 <div id="page-header"><a href="../index.html">Android Design</a></div>
20
21 <div id="main-row">
22
23 <ul id="nav">
24
25 <li class="nav-section">
26 <div class="nav-section-header"><a href="../index.html">Get Started</a></div>
27 <ul>
28 <li><a href="../get-started/creative-vision.html">Creative Vision</a></li>
29 <li><a href="../get-started/principles.html">Design Principles</a></li>
30 <li><a href="../get-started/ui-overview.html">UI Overview</a></li>
31 </ul>
32 </li>
33
34 <li class="nav-section">
35 <div class="nav-section-header"><a href="../style/index.html">Style</a></div>
36 <ul>
37 <li><a href="../style/devices-displays.html">Devices and Displays</a></li>
38 <li><a href="../style/themes.html">Themes</a></li>
39 <li><a href="../style/touch-feedback.html">Touch Feedback</a></li>
40 <li><a href="../style/metrics-grids.html">Metrics and Grids</a></li>
41 <li><a href="../style/typography.html">Typography</a></li>
42 <li><a href="../style/color.html">Color</a></li>
43 <li><a href="../style/iconography.html">Iconography</a></li>
44 <li><a href="../style/writing.html">Writing Style</a></li>
45 </ul>
46 </li>
47
48 <li class="nav-section">
49 <div class="nav-section-header"><a href="../patterns/index.html">Patterns</a></div>
50 <ul>
51 <li><a href="../patterns/new-4-0.html">New in Android 4.0</a></li>
52 <li><a href="../patterns/gestures.html">Gestures</a></li>
53 <li><a href="../patterns/app-structure.html">App Structure</a></li>
54 <li><a href="../patterns/navigation.html">Navigation</a></li>
55 <li><a href="../patterns/actionbar.html">Action Bar</a></li>
56 <li><a href="../patterns/multi-pane-layouts.html">Multi-pane Layouts</a></li>
57 <li><a href="../patterns/swipe-views.html">Swipe Views</a></li>
58 <li><a href="../patterns/selection.html">Selection</a></li>
59 <li><a href="../patterns/notifications.html">Notifications</a></li>
60 <li><a href="../patterns/compatibility.html">Compatibility</a></li>
61 <li><a href="../patterns/pure-android.html">Pure Android</a></li>
62 </ul>
63 </li>
64
65 <li class="nav-section">
66 <div class="nav-section-header"><a href="../building-blocks/index.html">Building Blocks</a></div>
67 <ul>
68 <li><a href="../building-blocks/tabs.html">Tabs</a></li>
69 <li><a href="../building-blocks/lists.html">Lists</a></li>
70 <li><a href="../building-blocks/grid-lists.html">Grid Lists</a></li>
71 <li><a href="../building-blocks/scrolling.html">Scrolling</a></li>
72 <li><a href="../building-blocks/spinners.html">Spinners</a></li>
73 <li><a href="../building-blocks/buttons.html">Buttons</a></li>
74 <li><a href="../building-blocks/text-fields.html">Text Fields</a></li>
75 <li><a href="../building-blocks/seek-bars.html">Seek Bars</a></li>
76 <li><a href="../building-blocks/progress.html">Progress &amp; Activity</a></li>
77 <li><a href="../building-blocks/switches.html">Switches</a></li>
78 <li><a href="../building-blocks/dialogs.html">Dialogs</a></li>
79 <li><a href="../building-blocks/pickers.html">Pickers</a></li>
80 </ul>
81 </li>
82
83 <li>
Roman Nurikc894fb72012-01-10 23:59:20 -080084 <div id="back-dac-section"><a href="../../index.html">Developers</a></div>
Roman Nurik73790462011-12-22 16:18:19 -080085 </li>
86
87 </ul>
88
89 <div id="content">
90
91
92 <div class="layout-content-row content-header">
93 <div class="layout-content-col span-9">
94 <h2>Notifications</h2>
95 </div>
96 <div class="paging-links layout-content-col span-4">
97 <a href="#" class="prev-page-link">Previous</a>
98 <a href="#" class="next-page-link">Next</a>
99 </div>
100 </div>
101
102
103
104
105<p>The notification system allows your app to keep the user informed about important events, such as
106new messages in a chat app or a calendar event.</p>
107<p>To create an app that feels streamlined, pleasant, and respectful, it is important to design your
108notifications carefully. Notifications embody your app's voice, and contribute to your app's
109personality. Unwanted or unimportant notifications can annoy the user, so use them judiciously.</p>
110<h4>When to display a notification</h4>
111<p>To create an application that people love, it's important to recognize that the user's attention and
112focus is a resource that must be protected. To use an analogy that might resonate with software
113developers, the user is not a method that can be invoked to return a value. The user's focus is a
114resource more akin to a thread, and creating a notification momentarily blocks the user thread as
115they process and then dismiss the interruptive notification.</p>
116<p>Android's notification system has been designed to quickly inform users of events while they focus
117on a task, but it is nonetheless still important to be conscientious when deciding to create a
118notification.</p>
119<p>While well behaved apps generally only speak when spoken to, there are some limited cases where an
120app actually should interrupt the user with an unprompted notification.</p>
121<p>Notifications should be used primarily for <strong>time sensitive events</strong>, and especially if these
122synchronous events <strong>involve other people</strong>. For instance, an incoming chat is a real time and
123synchronous form of communication: there is another user actively waiting on you to respond.
124Calendar events are another good example of when to use a notification and grab the user's
125attention, because the event is imminent, and calendar events often involve other people.</p>
126
127<img src="../static/content/notifications_pattern_real_time_people.png">
128
129<div class="vspace size-2">&nbsp;</div>
130
131<div class="layout-content-row">
132 <div class="layout-content-col span-7">
133
134<h4>When not to display a notification</h4>
135<p>There are however many other cases where notifications should not be used:</p>
136<ul>
137<li>
138<p>Don't notify the user of information that is not directed specifically at them, or information
139that is not truly time sensitive. For instance the asynchronous and undirected updates flowing
140through a social network do not warrant a real time interruption.</p>
141</li>
142<li>
143<p>Don't create a notification if the relevant new information is currently on screen. Instead, use
144the UI of the application itself to notify the user of new information directly in context. For
145instance, a chat application should not create system notifications while the user is actively
146chatting with another user.</p>
147</li>
148<li>
149<p>Don't interrupt the user for low level technical operations, like saving or syncing information,
150or updating an application, if it is possible for the system to simply take care of itself without
151involving the user.</p>
152</li>
153<li>
154<p>Don't interrupt the user to inform them of an error if it is possible for the application to
155quickly recover from the error on its own without the user taking any action.</p>
156</li>
157<li>
158<p>Don't use notifications for services that the user cannot manually start or stop.</p>
159</li>
160<li>
161<p>Don't create superfluous notifications just to get your brand in front of users. Such
162notifications will only frustrate and likely alienate your audience. The best way to provide the
163user with a small amount of updated information and to keep them engaged with your application is to
164develop a widget that they can choose to place on their home screen.</p>
165</li>
166</ul>
167
168 </div>
169 <div class="layout-content-col span-6">
170
171 <img src="../static/content/notifications_pattern_social_fail.png">
172
173 </div>
174</div>
175
176<h2>Design Guidelines</h2>
177
178<div class="layout-content-row">
179 <div class="layout-content-col span-6">
180
181 <img src="../static/content/notifications_pattern_anatomy.png">
182
183 </div>
184 <div class="layout-content-col span-6">
185
186<h4>Make it personal</h4>
187<p>For notifications of items sent by another user (such as a message or status update), include that
188person's image.</p>
189<p>Remember to include the app icon as a secondary icon in the notification, so that the user can
190still identify which app posted it.</p>
191
192 </div>
193</div>
194
195<h4>Navigate to the right place</h4>
196<p>When the user touches a notification, be open your app to the place where the user can consume and
197act upon the data referenced in the notification. In most cases this will be the detail view of a
198single data item (e.g. a message), but it might also be a summary view if the notification is
199stacked (see <em>Stacked notifications</em> below) and references multiple items. If in any of those cases
200the user is taken to a hierarchy level below your app's top-level, insert navigation into your app's
201back stack to allow them to navigate to your app's top level using the system back key. For more
202information, see the chapter on <em>System-to-app navigation</em> in the
203<a href="../patterns/notifications.html">Navigation</a> design pattern.</p>
204<h4>Timestamps for time sensitive events</h4>
205<p>By default, standard Android notifications include a timestamp in the upper right corner. Consider
206whether the timestamp is valuable in the context of your notification. If the timestamp is not
207valuable, consider if the event is important enough to warrant grabbing the user's attention with a
208notification. If the notification is important enough, decide if you would like to opt out of
209displaying the timestamp.</p>
210<p>Include a timestamp if the user likely needs to know how long ago the notification occurred. Good
211candidates for timestamps include communication notifications (email, messaging, chat, voicemail)
212where the user may need the timestamp information to understand the context of a message or to
213tailor a response.</p>
214<h4>Stack your notifications</h4>
215<p>If your app creates a notification while another of the same type is still pending, avoid creating
216an altogether new notification object. Instead, stack the notification.</p>
217<p>A stacked notification builds a summary description and allows the user to understand how many
218notifications of a particular kind are pending.</p>
219<p><strong>Don't</strong>:</p>
220
221<img src="../static/content/notifications_pattern_additional_fail.png">
222
223<p><strong>Do</strong>:</p>
224
225<img src="../static/content/notifications_pattern_additional_win.png">
226
227<p>If you keep the summary and detail information on different screens, a stacked notification may need
228to open to a different place in the app than a single notification.</p>
229<p>For example, a single email notification should always open to the content of the email, whereas a
230stacked email notification opens to the Inbox view.</p>
231<h4>Clean up after yourself</h4>
232<p>Just like calendar events, some notifications alert the user to an event that happens at a
233particular point in time. After that moment has passed, the notification is likely not important to
234the user anymore, and you should consider removing it automatically. The same is true for active
235chat conversations or voicemail messages the user has listened to, users should not have to manually
236dismiss notifications independently from taking action on them.</p>
237
238<div class="vspace size-1">&nbsp;</div>
239
240<div class="layout-content-row">
241 <div class="layout-content-col span-7">
242
243<h4>Provide a peek into your notification</h4>
244<p>You can provide a short preview of your notification's content by providing optional ticker text.
245The ticker text is shown for a short amount of time when the notification enters the system and then
246hides automatically.</p>
247
248 </div>
249 <div class="layout-content-col span-6">
250
251 <img src="../static/content/notifications_pattern_phone_ticker.png">
252
253 </div>
254</div>
255
256<h4>Make notifications optional</h4>
257<p>Users should always be in control of notifications. Allow the user to silence the notifications from
258your app by adding a notification settings item to your application settings.</p>
259<h4>Use distinct icons</h4>
260<p>By glancing at the notification area, the user should be able to discern what notification types are
261currently pending.</p>
262<p><strong>Do</strong>:</p>
263<ul>
264<li>Look at the notification icons the Android apps already provide and create notification icons for
265 your app that are sufficiently distinct in appearance.</li>
266</ul>
267<p><strong>Don't</strong>:</p>
268<ul>
269<li>Use color to distinguish your app from others. Notification icons should generally be monochrome.</li>
270</ul>
271
272<h2>Interacting With Notifications</h2>
273
274<div class="layout-content-row">
275 <div class="layout-content-col span-6">
276
277 <img src="../static/content/notifications_pattern_phone_icons.png">
278
279 </div>
280 <div class="layout-content-col span-6">
281
282<p>Notifications are indicated by icons in the notification area and can be accessed by opening the
283notification drawer.</p>
284<p>Inside the drawer, notifications are chronologically sorted with the latest one on top. Touching a
285notification opens the associated app to detailed content matching the notification. Swiping left or
286right on a notification removes it from the drawer.</p>
287
288 </div>
289</div>
290
291<div class="layout-content-row">
292 <div class="layout-content-col span-6">
293
294<p>On tablets, the notification area is integrated with the system bar at the bottom of the screen. The
295notification drawer is opened by touching anywhere inside the notification area.</p>
296
297 </div>
298 <div class="layout-content-col span-6">
299
300 <img src="../static/content/notifications_pattern_tablet.png">
301
302 </div>
303</div>
304
305<div class="layout-content-row">
306 <div class="layout-content-col span-6">
307
308 <img src="../static/content/notifications_pattern_ongoing_music.png">
309
310 </div>
311 <div class="layout-content-col span-6">
312
313<h4>Ongoing notifications</h4>
314<p>Ongoing notifications keep users informed about an ongoing process in the background. For example,
315music players announce the currently playing track in the notification system and continue to do so
316until the user stops the playback. They can also be used to show the user feedback for longer tasks
317like downloading a file, or encoding a video. Ongoing notifications cannot be manually removed from
318the notification drawer.</p>
319
320 </div>
321</div>
322
323<div class="layout-content-row">
324 <div class="layout-content-col span-12">
325
326<h4>Dialogs and toasts are for feedback not notification</h4>
327<p>Your app should not create a dialog or toast if it is not currently on screen. Dialogs and Toasts
328should only be displayed as the immediate response to the user taking an action inside of your app.
329For instance, dialogs can be used to confirm that the user understands the severity of an action,
330and toasts can echo back that an action has been successfully taken.</p>
331
332 </div>
333</div>
334
335<div class="vspace size-1">&nbsp;</div>
336
337<img src="../static/content/notifications_pattern_dialog_toast.png">
338
339
340
341
342
343 <div class="layout-content-row content-footer">
344 <div class="paging-links layout-content-col span-9">&nbsp;</div>
345 <div class="paging-links layout-content-col span-4">
346 <a href="#" class="prev-page-link">Previous</a>
347 <a href="#" class="next-page-link">Next</a>
348 </div>
349 </div>
350
351 </div>
352
353 </div>
354
355 <div id="page-footer">
356
357 <p id="copyright">
358 Except as noted, this content is licensed under
Roman Nurikc894fb72012-01-10 23:59:20 -0800359 <a href="http://creativecommons.org/licenses/by/2.5/">
Roman Nurik73790462011-12-22 16:18:19 -0800360 Creative Commons Attribution 2.5</a>.<br>
361 For details and restrictions, see the
Roman Nurikc894fb72012-01-10 23:59:20 -0800362 <a href="http://developer.android.com/license.html">Content License</a>.
Roman Nurik73790462011-12-22 16:18:19 -0800363 </p>
364
365 <p>
Roman Nurikc894fb72012-01-10 23:59:20 -0800366 <a href="http://www.android.com/terms.html">Site Terms of Service</a> &ndash;
367 <a href="http://www.android.com/privacy.html">Privacy Policy</a> &ndash;
368 <a href="http://www.android.com/branding.html">Brand Guidelines</a>
Roman Nurik73790462011-12-22 16:18:19 -0800369 </p>
370
371 </div>
372 </div>
373
374 <script src="../static/jquery-1.6.2.min.js"></script>
375 <script>
376 var SITE_ROOT = '../';
377 </script>
378 <script src="../static/default.js"></script>
379
380
381 <script type="text/javascript">
382 var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
383 document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
384 </script>
385 <script type="text/javascript">
386 var pageTracker = _gat._getTracker("UA-5831155-1");
387 pageTracker._trackPageview();
388 </script>
389 </body>
390</html>