建立以進度為主軸的通知

以進度為主的通知
圖 1. 遮罩頂端的進度通知。

Android 16 推出新的通知範本,可協助使用者順暢追蹤使用者啟動的端對端歷程。這些通知在系統介面上的顯示效果會有所提升,並在通知面板中獲得優先排名。

使用 Notification.ProgressStyle 為以進度為主的通知設定樣式。主要用途包括共乘、外送和導航。在該課程中,您將瞭解如何使用「點」和「區隔」來標示使用者歷程中的狀態和里程碑。

相關類別

以下類別包含用於建構 ProgressStyle 通知的不同 API:

剖析與自訂

下圖顯示組成 ProgressStyle 通知的不同部分:

圖 2.ProgressStyle notification.
Figure 3. Apps can set a vehicle image for the tracker icon and use segments and points to denote the rideshare experience and milestones.

Set up

Use the right APIs and follow best practices to provide the best user experience for progress updates.

  • Set the right fields to meet promoted visibility.
  • Use the right visual elements to guide users. For example, rideshare apps should set a vehicle image and use the most accurate color of the vehicle in the notification using Notification#setLargeIcon.
  • Use concise and clear language to define the progress of the user journey. Time of arrival, driver name, and state of the journey are important text that the notification should communicate.
  • Provide useful and relevant actions in the notification that streamline the user journey. For example, providing "Tip" and "Add dish" to a newly initiated food delivery order are useful actions before delivery.
  • Use segments and points to denote states. For example, segments can colorize the state and duration of traffic in a rideshare journey. Points represent states for milestones such as food preparation, delivery, and passenger pickup.
  • Update the progress experience to accurately reflect the actual progression of the journey. For example, changes in traffic conditions can be reflected in changes in segment colors and updates in text.

The following example shows a ProgressStyle notification for a rideshare app.

The example shows the use of a vehicle image for the tracker icon. It also shows the use of segments and points to denote the rideshare experience and milestones.

See the sample app to experiment with these APIs.

的不同部分