在用户没有使用应用时,“通知”会提供与该应用相关的简短、即时的信息。

Notifications provide short, timely, and relevant information about your app when it’s not in use.


用法

通知用于告知用户应用程序中发生的各种事件。

最常用到的通知形式有以下两种:

  • 其它用户的消息推送
  • 适时且包含丰富信息的任务提醒

Notifications are intended to inform users about events in your app. These two types of notifications are the most effective:

  • Communication from other users
  • Well-timed and informative task reminders

Notification Anatomy

通知组件的结构分析:

  • 顶部区域
  • 内容区域
  • 操作区域

How notifications may be noticed

通知是如何引起用户的注意:

  • 状态栏的图标
  • 锁屏通知
  • 语音提示或振动
  • 顶部弹出
  • 设备 LED 闪烁

  • Showing a status bar icon

  • Appearing on the lock screen
  • Playing a sound or vibrating
  • Peeking onto the current screen
  • Blinking the device’s LED

什么时候不用通知

通知不是系统与用户沟通的主要渠道,频繁的发布通知会中断用户的操作,降低用户体验。

以下几种情况不需要使用通知:

  • 交叉促销,或是在广告通知中介绍其它产品(Play Store 中严禁发生这种行为)
  • 当用户从未打开过的应用程序时,该应用程序不可以向用户推送任何通知
  • 诱导用户回归应用程序,但是通知内没有包含有价值的信息。例如,通知内包含“好久不见”的字样
  • 邀请用户对应用程序进行评级
  • 不需要用户参与的操作,例如同步信息
  • 程序异常,但是可以自动恢复时

Notifications should not be the primary communication channel with your users, as frequent interruptions may cause irritation. The following cases do not warrant notification:

  • Cross-promotion, or advertising another product within a notification, which is strictly prohibited by the Play Store
  • An app that a user has never opened
  • Messages that encourage the user to return to an app, but provide no direct value, such as “Haven’t seen you in a while”
  • Requests to rate an app
  • Operations that don’t require user involvement, like syncing information
  • Error states from which the app may recover without user interaction

image.png
Don’t
不要以通知的形式发送节日或生日问候。
Don’t send holiday or birthday greetings in the form of notifications.

image.png
Don’t
不要在用户使用过程中向用户推送无用的信息。
Don’t interrupt the user in the middle of a task for the sole purpose of asking if you’re doing a good job.


什么时候需要通知

有时候在后台运行的应用程序会因为电池消耗过大或者其它的数据,需用在前台通过通知告知用户,用户无需进行交互。

由于无需进行交互,系统需要提供关闭这项服务的选项。

Foreground services are app processes that run in the background while the user is not directly interacting with your app. Because these apps use battery and possibly data, Android requires that users are made aware of these types of services by showing a non-dismissible notification.

Because the user can’t dismiss the notification, you should provide an action for the user to stop the service if they don’t want it running.
image.png
在下载应用程序和文件时,Android 的下载管理器运行一个前台服务,并显示一个通知,让用户知道下载正在进行中,可以选择取消。
While downloading apps and files, Android’s Download Manager runs a foreground service and shows a notification that lets the user know downloading is in progress, with an option to cancel.


解析

通知的内容简单,易于浏览,是 Material Design 的组件中很重要的部分。

Notifications have been designed to make it easy to scan and use a notification’s most important elements:
image.png
折叠状态的通知组件
Collapsed view of a notification

内容区域

内容是通知组件中的核心元素,内容分为主要内容与次要内容,次要内容(如时间戳)所占的位置较小,用于对主要内容进行补充。

Content is the most prominent element of a notification. Secondary information, such as a timestamp, is smaller and consolidated above the primary content.

头像

如果通知的内容涉及个人,那么对应的头像会显示在主要内容的右侧,与其它的区域进行区分。

If the notification involves a person, an avatar appears on the right where it stands out from the rest of the content.

操作

当通知的内容有隐藏部分时,可以设置“展开”按钮用于扩展通知组件。

Expandable notifications are revealed by tapping an indicator icon. Actions are displayed with text labels on a separate background color and location.

顶部区域

image.png
顶部区域
The header area

顶部区域包括:

  1. 应用图标:
    1. 应用图标是应用的 Logo
    2. 在状态栏中单色显示
    3. 如果应用需要向用户推送不同类型的通知,那么可以根据不同的类型来设计通知中的应用图标
    4. 例如,Google 即时使用云图标来显示天气通知
  2. 应用名称:
    1. 应用名称会自动显示在通知中
  3. 通知标题(可选):
    1. 通知的来源有多个时,需要通过标题来告知用户
    2. 例如,来自其他用户的邮件通知
  4. 时间戳(可选):
    1. 默认情况下,不会显示时间戳,但是如果通知的发送时间(例如未接来电的时间)很重要,则可以添加时间戳
  5. “展开”按钮:
    1. 如果通知可以扩展,则会出现

The header area is comprised of:

1. The app icon:
The app icon is a small two-dimensional representation of your app’s identity. It appears in monochrome in the status bar. If your app sends a wide variety of notifications, you may replace your app’s identity icon with a symbol that reflects the content type. For example, Google Now uses a cloud icon for weather notifications.

2. The app name:
The name of the app automatically appears in the notification.

3. Header text (optional):
Header text is usually only needed if an app sends notifications from multiple sources, such as the account name for users with multiple accounts.

4. Timestamp (optional):
By default, a timestamp does not appear, but it may be added if it’s important to display when a notification was sent, such as the time of a missed call.

5. Expand indicator:
This appears if the notification can be expanded.


内容区域

image.png
内容区域
The content area

内容区域包括:

  1. 标题:
    1. 通知的标题
  2. 内容:
    1. 通知的内容
  3. 图像(可选):
    1. 图像不局限于头像,如果通知的内容需要图像进行补充,可以添加图像。
    2. 例如,邮件通知的发件人头像

1. A content title:
A brief headline for the notification

2. Content text:
Supporting information

3. Large icon (optional):
An image may be added to reinforce the notification in a meaningful way, such as a message that includes an avatar of the sender.


操作区域

在通知组件中,交互操作一般是隐藏在组件底部的,并且最多设置三个。

在 Android N 和更高版本中,显示的操作没有图标以容纳更多文本仍然应该提供一个图标,因为具有早期版本操作系统的设备依赖它,Android Wear 和 Android 自动设备也依赖它。

When expanded, a notification may display up to three actions at the bottom.

In Android N and later, actions are shown without icons to accommodate more text. An icon should still be provided because devices with earlier versions of the OS rely on it, as will Android Wear devices.
image.png
交互区域
The action area


行为

通知预览

当应用的信息推送到手机时,它们会被放在通知栏中。

根据用户的手机设置以及设备当前的状态,通知栏可能还会有其它的行为:

  • 顶部状态栏中显示图标
  • 发出声音或者振动
  • 通过浮窗来转移用户的注意力

When a notification arrives, it gets added to the notification drawer. Depending on the parameters you set and the current state of the device, the notification may also:

  • Be indicated in the status bar with an icon
  • Make a sound or vibrate
  • Peek onto the current screen to grab the user’s attention

用户可以选择更改手机设置的来管理通知行为。

Users may choose to alter the notification behaviors you set. mio-design_assets_1CfZrxDhHfWFStu9tKiqD6MQHAWpAO3CR_notifications-arrival-1.mp4 (17.73KB)当通知推送到手机时,状态栏通常会显示一个图标来通知用户可以打开通知栏查看。
When a notification arrives, an icon usually appears in the status bar. This signals to the user that there’s something to see in the notification drawer.

mio-design_assets_1R6V5oqkr0dbbstx5tvR5R_IjEg6kwT4x_notifications-arrival-2.mp4 (55.26KB)如果需要用户及时处理,那么通知可以直接出现在当前页面的上方。
If it’s important to grab a user’s attention in the middle of a task, an app can have the notification peek onto the current screen.


通知栏

在 Android 的通知栏中,通知的显示顺序主要受以下几个因素影响:

  • 优先级(重要性)
  • 是否通过强提醒(振动、声音)来通知用户
  • 是否包含真人信息(尤其是带星标的人)
  • 是否包含正在进行的行为,例如通话或者多媒体

从 Android O 开始,Android 系统会根据设置通知的优先级来调整通知的外观,以帮助用户快速查看通知栏的内容。

The notification drawer in Android typically shows notifications in reverse-chronological order, with adjustments influenced by:

  • The app’s stated notification priority or importance
  • Whether the notification recently alerted the user with a sound or vibration
  • Any people attached to the notification and whether they are starred contacts
  • Whether the notification represents an important ongoing activity, such as a phone call in progress or music playing

Starting in Android O, the Android system may alter the appearance of some notifications at the top and bottom of the list by adding emphasis or deemphasis, to help the user scan content.

过期通知

通知栏中的内容应该是当前时刻与用户有关的,如果此前的通知已不再具有实时性,系统可以自动取消通知,避免通知栏过于拥挤。

The notification drawer should show users relevant information for the current moment in time. If a notification sent earlier is no longer relevant, you can automatically dismiss it so the user doesn’t see it.

image.png
在图例中,通知栏的顶部出现的是刚刚推送的信息,而优先级较低的天气通知则会放在底部。
In this notification drawer, a text that just arrived appears at the top. A lower priority notification about the weather appears at the bottom.


交互

用户可以通过以下方式与推送进行交互:

Users may interact with a notification in the following ways:

1.跳转

用户可以点击推送来跳转到相应的应用。
当手机处于锁屏状态时,用户双击通知后,解锁屏幕即可完成跳转操作。

1. To navigate to a destination

To navigate, a user may tap a notification. If the notification appears on a locked screen, the user will need to double-tap it and then enter their PIN, pattern, or password.
When the user taps a notification, they should be taken to a screen in your app that relates directly to that notification and lets them take immediate action. For example, if the notification says it’s their turn in a two-player game, tapping the notification should take them directly to that game.

2.视图扩展

如果推送的卡片有扩展功能,用户点击按钮或下滑通知可以将推送卡片展开。

If offered, an expand indicator appears in the header. A user may tap the indicator or swipe down the notification body to expand it.

mio-design_assets_1BYUlH5r8qNfUotaZOuwPWffN_uDQYxD3_notifications-expand-1.mp4 (97.7KB) 展开的通知卡片
An expanded notification

3.消除

用户可以通过左右滑动来消除推送。

通知栏中的推送如果是正在运行的应用(例如音乐播放),那么用户不能直接通过滑动操作来消除。

A user may dismiss a notification by swiping it left or right.

Ongoing notifications that indicate a continuing process in the background, such as music playing, may not be dismissed with a swipe.

mio-design_assets_1S2DsfREz0wAgF3TPvUZYpgqoDFZ4iaPY_notifications-dismiss-1.mp4 (120.68KB)消除推送卡片。
A notification being dismissed

4.通用操作

一般来说,我们可以通过以下几种方式来控制通知推送:

  • 长按后显示下一步可以进行操作
  • 左滑或右滑后显示下一步可以进行操作

控件的内容可能会根据实际情况有所不同,具体取决于 Android 版本以及应用的程序设计。

Notification controls can be accessed by:

  • Touching and holding an individual notification
  • Swiping the notification left or right, and then tapping the settings icon

The controls displayed vary depending on the Android version and whether the app has channels for its notifications (starting in Android O).

mio-design_assets_1pT72NOTYw7pGMJU4ioBIhekvMZbc9ttH_notifications-controls-1.mp4 (67.82KB)推送设置。
Notification settings


复合通知

对于生成多个相同类型通知的应用,Android 提供了两种不同的展示方式:合并与捆绑。

For apps that generate multiple notifications of the same type, Android offers two different approaches to represent them: summarizing and bundling.

合并

将一个应用的推送合并到一张卡片上。
例如,邮件应用在推送时,卡片上的标题内容是 “3 new messages” ,在扩展后显示每一条信息的摘要。

Instead of displaying multiple notifications, you can create one notification that summarizes them all. For example, a messaging app might have a summary notification that says “3 new messages.” Upon expansion, it could show a snippet for each message.

image.png
复合通知的合并展示。
Multiple notifications summarized, shown in collapsed view.

image.png
合并展示卡片扩展后可以看到每一条信息的摘要。
Multiple notifications summarized, shown in expanded view.

分组

应用程序可以根据层级结构显示多个推送:

  • 父级通知显示子级通知的摘要
  • 父级通知扩展后,将显示所有的子级通知
  • 子级通知扩展后,可以查看子级通知的全部内容

父级通知扩展后,子级通知的标题不能重复。
例如,父级通知中包含图标时,子级通知则不需要使用图标。

根据推送到达的时间,最新的子通知可以单独显示,不归入父级通知的卡片。

Your app can present multiple notifications according to hierarchy:

  • A parent notification displays a summary of its child notifications
  • If the parent notification is expanded by the user, all child notifications are revealed
  • A child notification may be expanded to reveal its entire content

Child notifications are presented without duplicate header information. For example, if a child notification has the same app icon as its parent, then the child’s header doesn’t include an icon.

Child notifications should be understandable if they appear solo, as the system may show them outside of the group when they arrive.
image.png
合并视图。
Grouped notifications collapsed view

image.png
扩展视图。
Grouped notifications expanded view


扩展视图

用户可以通过扩展视图来查看更多的信息,不需要跳转到其它页面。

You may display more information in a notification through an expanded view, without navigating away from the notification.
image.png
默认视图。
Collapsed notification

image.png
扩展视图。
Expanded notification

卡片展开时,最多提供三个操作。
用户不能在推送卡片上重复进行点击操作。

A notification may offer up to three actions when expanded. It should not duplicate the action taken from tapping on the notification body.
image.png
Don’t
推送卡片不是操作页面,用户不能在推送卡片上重复进行点击操作。
用户点击图例中的按钮会更改卡片内容。
Don’t include text actions that duplicate the behavior of tapping on the notification body.

image.png
Do
用户可以直接在闹钟应用的推送卡片中进行延时操作。
When Android’s Clock app has a timer running, this notification lets the user pause or add a minute directly from the notification.


推送中的快速回复

在需要回复的推送中,用户可以直接通过推送卡片来回复少量文本,例如短信或者速记。

如果需要回复长文,推送需要引导用户跳转到相应的应用程序进行操作。

直到用户结束通话为止,包含回复功能的推送不可以自动关闭。

You may enable the user to type directly into a notification. Users may type small amounts of text, such replying to a text message or jotting a brief note.

For long-form typing, navigate users to your app, where they benefit from more space to view and edit text.

If you’re using this functionality for a messaging app, keep the notification present after the user has sent the reply, and wait until the conversation is paused before automatically dismissing it. mio-design_assets_1un-9WpfChyZpj-X2jvAY94qRPX_hbGGO_notifications-enabletyping.mp4 (164.14KB)短信应用的用户可以直接在推送卡片中回复短信。
Users of Android’s Messages app can reply directly to any message without leaving the notification


分类

通知被认为是事务性的或非事务性的。

Notifications are considered either transactional or non-transactional.

即时性通知

我们可以通过以下几个方式来判断通知是否为即时性通知:

  • 真实用户之间的互动
    • 短信
    • 电话
    • 游戏邀请
  • 强提醒
    • 闹钟
    • 待办事项
    • 订单追踪
    • 航班延误通知
  • 即时状态或操作
    • 音乐播放
    • 导航
    • 倒计时
    • 截图
    • 非正常的应用后台运行
  • 不符合以上三条的即可判断为 非即时性通知

Transactional notifications provide content that a user must receive at a specific time in order to do one of the following:

  • Enable human-to-human interaction
  • Function better in daily life
  • Control or resolve transient device states

If none of the above situations describe your notification, then it is non-transactional.

Transactional notifications can help users… Examples
Enable human-to-human interaction • Incoming phone calls or text messages
• Notification of a user’s turn in a two-player game
Function better in daily life • Calendar event about to take place
• A reminder or alarm set up by the user
• Delayed flight
• Delivered order
Monitor, control, or resolve temporary
device states
• Music playing
• Turn-by-turn navigation
• Stopwatch running
• Screenshot taken
• App running in the background

非即时性通知的开关

非即时性通知不可以以即时性通知的方式来吸引用户注意力,用户可以通过以下两种方式来控制非即时性通知:

  • 关闭:用户可以通过长按或者手机设置来停止接收来自该应用的非即时性通知
  • 打开:用户可以通过手机设置来接收来自该应用的非即时性通知

Non-transactional notifications should be optional, as they may not appeal to all users. You can make them optional in one of two ways:

  • Opt-out: Users receive opt-out notifications by default, but they may stop receiving them by turning off a setting.
  • Opt-in: Users only receive opt-in notifications by turning on a setting in your app.

关闭

为了避免用户直接关闭来自应用程序的非即时性通知,设计推送时应该满足以下两个条件:

  • 能为用户提供价值
  • 投其所好,与用户能产生共鸣

Avoid the opt-out approach unless your notifications meet both of the following criteria:

  • They provide concrete value to the user
  • They clearly relate to the user’s context (such as current location, current date or time, past history, or expressed interests)
Example notification Reason to avoid using opt-out notifications here
A random tip on how to use an app Provides concrete user value but isn’t contextual
A prompt to rate content recently used in the app Contextual, but doesn’t provide concrete
user value

image.png
图例中的非即时性通知根据用户的订阅(投其所好)来推送新的视频(提供价值),而提供的选项又给用户留下了选择的空间,并非只能跳转到 YouTube 应用,用户还可以选择“稍后观看”,降低了用户的反感。

This notification from YouTube takes the opt-out approach. It offers both context (a YouTube channel the user has subscribed to) and value (a new video from that channel). The “Options” action navigates the user to where they can opt out of future notifications for this channel.

开启

应用不应该默认开启非即时性通知的推送开关,应该提前询问用户是否允许开启。
即使用户选择关闭操作,也不可以反复进行确认,只需要提供用户重新开启这些通知的方法即可。

The opt-in approach is more conservative. Because users explicitly choose to receive these notifications, it’s more likely they’ll be glad to see them. However, they must visit settings to find out how to receive them. You may inform users about these notifications from other places in your app, such as an onboarding flow or a dismissible card.
image.png
应用不应该默认开启非即时性通知的推送开关,应该提前询问用户是否允许开启。
即使用户选择关闭操作,也不可以反复进行确认,只需要提供用户重新开启这些通知的方法即可。

This app takes the opt-in approach. A card at the top of the app lets users know that they can receive notifications for breaking news stories. If the user wants to opt in, they choose “Yes.” Otherwise, they choose “No Thanks” and remain opted out. This choice is also available in the app’s settings.


设置

Android O 中的通知分类

Android O 以上的系统运行时,应用的设计者应该将通知进行分类,用户可以选择接收或关闭应用程序的某一类通知,而不是直接关闭所有的通知推送。

When you upgrade your app to Android O, you’ll be required to define channels for your notifications – one for each type of notification you want to send.

Users control app notifications in Android O with channels. If a user doesn’t want a certain notification from your app, they can block that channel rather than all notifications.

image.png
用户可以根据自己的需要来控制某一个应用中各种类型的通知。
This app has three channels, which may be referred to as “categories” in the UI.

重要性级别

对于设计者定义的每一个分类,都需要分配一个重要性级别。
从 Android O 开始,重要性级别取代了优先级来控制每个分类的设计规范。

重要性级别具有以下两点限制:

  • 设计者分配的重要性级别为默认设置,用户可以在设置中更改频道的重要性级别
  • 应用的默认设置被更改后,设计者无法再进行调整,只有用户未进行设置时,可以调低重要性级别

设计者在分配通知的重要性级别时,需要考虑用户的时间成本与注意力。
如果设计者将非即时性通知伪装成即时性通知,应用会产生不必要的推送,进而流失用户。

For each channel you define, you’ll assign it an importance level. Starting in Android O, importance levels control the behavior of each channel (taking the place of priority levels).
Importance levels have the following restrictions:

  • The importance level you assign will be the channel’s default. Users can change a channel’s importance level in Android Settings.
  • Once you choose an importance level, you’re limited in how you can change it: you may only lower the importance, and only if the user hasn’t explicitly changed it.

Channel importance should be chosen with consideration for the user’s time and attention.

When an unimportant notification is disguised as urgent, it can produce unnecessary alarm.

Importance Behavior Usage Examples
HIGH Makes a
sound and
appears on
screen
Time-critical information that the user
must know, or act on, immediately
Text messages, alarms,
phone calls
DEFAULT Makes a
sound
Information that should be seen at the
user’s earliest convenience, but not
interrupt what they’re doing
Traffic alerts, task
reminders
LOW No sound Notification channels that don’t meet the
requirements of other importance levels
New content the user
has subscribed to,
social network
invitations
MIN No sound or
visual
interruption
Non-essential information that can wait
or isn’t specifically relevant to the user
Nearby places of
interest, weather,
promotional content

分类

盘点所有应用可能会出现的推送,再进行分类。

一次推送的内容应该可以被简洁地描述。

例如下载通知可以分为三个区域:

  • 下载主题
  • 下载内容
  • 操作区域

设计者应该从用户的角度出发,将相似的通知归入同一个重要性级别。

To define your channels, take inventory of all the notifications you want to send. Group these notifications into sets that have the following things in common:

  • Subject matter. A single topic can succinctly describe all of these notifications, such as “Downloads.”

Desired importance level. Because notifications in a channel share one importance level, they should carry a similar level of importance to one another from the user’s perspective.

分组

通过对权限进行分类,用户可以轻松地在设置中找到自己需要开启或关闭的选项。

需要分组的情况:

  • 10个以上的权限请求
  • 应用支持多个账户,并且允许用户在各个账户中使用相同的权限分组

You can group your channels to make it easier for users to scan your list of channels in Android Settings.

Only create channel groupings if:

  • You have more than 10 channels
  • Your app supports multiple user accounts (such as personal and business accounts) allowing users to have the same channel names and functions across accounts

Link your app’s settings to Android channel settings

保持应用设置 与 Android 系统设置一致

应用程序中的通知权限设计需要连接到 Android 设置中,用户可以集中在系统设置中对应用设置进行更改。

Keep the settings in your app consistent with those in Android channels. If your app offers controls for different types of notifications, direct users to the settings of the appropriate Android channel settings to make changes.

前台服务

在 Android O 中,权限的前台服务通知的级别至少应该是 IMPORTANCE_LOW,这样才可以在状态栏中显示图标。

n Android O, a channel’s default importance level for foreground service notifications must be at least IMPORTANCE_LOW so that it shows an icon in the status bar.

Channels using the less-prominent IMPORTANCE_MIN level will trigger an extra notification from Android at IMPORTANCE_LOW, stating that the app is using battery.


Priority levels without channels

在 Android O 以下的版本中,设计者需要为每种通知分配优先级。

For apps not yet upgraded to Android O, you’ll need to assign a priority level for each individual notification. Some priority levels offer the option to play sound.

优先级

为了将每个通知推送准确的传递给用户,设计者需要为每种通知分配优先级。

优先级越高,对用户当前行为的打断程度越高。

例如,MAX 与 HIGH 的优先级会直接出现在屏幕上,无论用户当前的状态。

To affect how each notification is delivered to users, assign it a priority level. The higher the priority, the more interruptive it will be. For example, MAX and HIGH priority notifications will peek onto the user’s current screen, regardless of what they are doing. When in doubt, choose a lower priority.

音效

优先级在 default 以上的通知可以在推送时使用音效。以下为设计者可以使用音效的几种情况:

  • 与时间相关的社交操作(电话、会议通知)
  • 日常生活中的帮助提醒(航班延误通知)
  • 用户自行设置的声音提醒(需要用户主动开启,默认为关闭)

Notifications assigned a priority of DEFAULT (or higher) have the option to play a sound (using a sound file you provide) when the notification is delivered. However, a notification should only use sound if:

  • It helps the user uphold a time-sensitive social expectation, such as an incoming phone call or imminent work meeting.
  • It helps the user in daily life, such as letting them know that a flight is delayed.
  • The user has explicitly requested that this notification make a sound upon arrival (this option is off by default).

预定义设置

无论设计者是否使用 Android O 中的通知权限分类,都需要为各种通知推送分配合适的预定义级别。

系统可能会根据这些设置来给各个应用的通知进行排序和过滤。

Whether you’re using channels or not, assign each individual notification to the most suitable predefined category. Android may use this information to make ranking and filtering decisions.

Category Description
CATEGORY_CALL Incoming call (voice or video) or similar synchronous
communication request
CATEGORY_MESSAGE Incoming direct message (SMS, instant message, etc.)
CATEGORY_EMAIL Asynchronous bulk message (email)
CATEGORY_EVENT Calendar event
CATEGORY_PROMO Promotion or advertisement
CATEGORY_ALARM Alarm or timer
CATEGORY_PROGRESS Progress of a long-running background operation
CATEGORY_SOCIAL Social network or sharing update
CATEGORY_ERROR Error in background operation or authentication status
CATEGORY_TRANSPORT Media transport control for playback
CATEGORY_SYSTEM System or device status update. Reserved for system use.
CATEGORY_SERVICE Indication of running background service
CATEGORY_RECOMMENDATION A specific, timely recommendation for a single thing.
For example, a news app might recommend a news story the
user might want to read next.
CATEGORY_STATUS Ongoing information about device or contextual status

锁屏

在锁屏状态下,用户自行可以选择是否显示通知。

显示在锁屏界面上的通知需要隐藏所有敏感的内容。

Android 系统会根据应用的可见性级别,显示安全内容。

A user may choose to show notifications when their screen is locked. These notifications may conceal any content that an app marks as sensitive. Android evaluates each notification’s visibility level to figure out what can safely be shown.

敏感信息

由于通知在锁定屏幕上可见,设计者应该把保护用户隐私放在首位。

一般来说,可见性级别分为三种:全部可见、部分可见以及完全不可见。

公共通知在锁屏界面上是完全可见的,个人通知在锁屏界面上出现时,用户可以选择显示基本信息还是隐藏所有信息。

Because notifications are visible on the lock screen, user privacy is an important consideration. For each notification you create, a visibility level is set to either public, private, or secret.

Public notifications are fully visible on secure lock screens, while secret notifications are hidden.

Private notifications fall in the middle: they show only basic information, including the name of the app that posted it and its icon. In place of the regular content – which will be hidden – you have the option to show text that doesn’t reveal personal information, such as “2 new messages”.
image.png
该用户选择在锁屏界面显示所有通知内容。
This user has chosen to show all notification content on the lock screen.

image.png
该用户选择隐藏所有个人信息,只展示信息数目。可见性处于最低级别时,不会出现任何与个人信息有关的内容。
This user has chosen to hide sensitive content from the lock screen. Because these apps gave their notifications a visibility level of “private,” no content title or text appears.


样式

简洁明了

Android 系统的通知卡片上,标题与内容都各占一行。

标题规范:

  • 30 个字符以内
  • 最重要的信息
  • 避免使用变量(除非变量包含数字、短文本字符串或者在文本之前)
  • 删去包含标题中的应用名称的字眼

Android truncates content titles to a single line (even when expanded).
Content titles should:

  • Be under under 30 characters long
  • Contain the most important information
  • Avoid variables – unless they contain a number or short text string, or are preceded by text
  • Exclude the app’s name, which already appears in the header

image.png
Don’t
标题与应用程序重复,并且内容冗长。
The content title shows the app name, which is redundant with the header area and uses up available characters.

内容规范:

  • 尽量避免内容文本超过 40 个字符
  • 避免内容与标题的内容出现重复

Content text should:

  • Avoid exceeding the 40-character limit
  • Not repeat what’s in the content title

image.png
Do
标题与内容各司其职,确保用户能够一目了然。
The content title shows the most important information.


大图标

在 Android N 中,大图标仅在以下几种情况中使用:

  • 来自其他用户的通信,例如在通知卡片上加入发送短信时对方使用的头像,能够快速帮助用户识别信息的来源
  • 内容来源,例如用户在 YouTube 中订阅的频道在更新时产生的推送
  • 有意义的符号,例如驾驶模式时,通知中的箭头

大图标的显示区域为正方形。

In Android N, the large icon is only meant for specific situations in which imagery meaningfully reinforces the notification’s content, including:

  • Communication from another person, such as the image of someone sending a message
  • The source of content if it’s different than the app sending the notification, such as the logo from a YouTube channel to which the user is subscribed
  • Meaningful symbols about the notification, such as an arrow symbol for driving directions

Large icons should be circular when showing a person, but square in all other cases.
image.png
Don’t
大图标中不能出现与品牌元素重复度过高的元素。
The large icon is not intended for branding.

image.png
Do
用户能够通过头像更快的理解信息来源。
The large icon is meant to reinforce the content of the notification in a meaningful way, such as a person’s photo attached to a message notification.


模板

Google 在自己的 Android 程序中设计了以下几种模板,其他设计者可以进行参考。

Google uses the following notification templates in its Android apps. These templates can be customized to some extent for your app.

标准模板

标准模板适用于大多数通知,一般包括以下几种元素:

  • 通知来源
  • 标题
  • 内容
  • 可选元素
    • 按钮
    • 图标

The standard template is suitable for most notifications, allowing succinct text, a large icon (when applicable), and actions.
image.png
标准模板。
Standard template for collapsed notifications

image.png
带按钮的标准模板。
Standard template for expanded notifications


长文本模板


显示长文本时,设计者可以选择长文本模板。通过扩展卡片让用户预览更多的内容。

This template should be used when long text is displayed. It lets the user preview more text when the notification is expanded.
image.png
长文本模板的折叠状态。
Big text template for collapsed notifications

image.png
长文本模板的展开状态。
Big text template for expanded notifications


图片模板

当通知中包含图片时,可以使用图片模板。

图片模板提供图片缩略图,用户可以通过展开卡片查看更大的图片。

This template should be used when a notification contains a picture. The large icon offers a thumbnail of the picture, and the user can get a bigger preview by expanding the notification.
image.png
图片模板的折叠状态。
Big picture template for collapsed notifications

image.png
图片模板的展开状态。
Big picture template for expanded notifications


进度条模板

进度条模板用于指示用户所进行的操作进行到什么阶段,如果系统允许(部分操作无法终止),用户随时可以取消操作。

This template should be used for user-initiated activities that take time to complete and can be canceled at any time. (Non-cancelable activities don’t warrant notifications.)
image.png
进度条模板的折叠状态。
Progress template for collapsed notifications

image.png
进度条模板的展开状态。
Progress template for expanded notifications


媒体模板

用户可以通过媒体模板来控制正在播放的媒体。

  • 媒体模板的折叠状态下,最多显示三个操作按钮
  • 图标可以显示与正在播放的内容相关的图像,例如专辑封面
  • 媒体模板的展开状态下,最多显示五个操作按钮,如果没有图像展示,则可以显示六个操作按钮
  • 卡片颜色可以根据图像配色进行调整,为用户提供沉浸感

This template lets the user control media currently playing from an app.

  • The collapsed view displays up to three actions, and the large icon can show a related image, such as an album cover.
  • The expanded view displays up to five actions with a larger image, or six actions if no image is displayed. Colors from provided images automatically color the notification’s background and other elements.

image.png
媒体模板的折叠状态。
Media template for collapsed notifications

image.png
媒体模板的展开状态。
Media template for expanded notifications


消息模板

消息模板用于实时通信程序。

设计者可以自愿提供用户直接在通知中输入回复的功能。

This template is for real-time communication. Optionally, you can offer users the ability to type replies directly into the notification.
image.png
折叠状态。
Messaging template for collapsed notifications

image.png
展开状态。
Messaging template for expanded notifications