Membuat notifikasi yang berfokus pada progres

Notifikasi yang berfokus pada progres
Gambar 1. Notifikasi yang berfokus pada progres di bagian atas menu samping.

Android 16 memperkenalkan template notifikasi baru untuk membantu pengguna melacak perjalanan awal hingga akhir yang dimulai pengguna dengan lancar. Notifikasi ini akan memiliki visibilitas yang ditingkatkan di platform sistem dan peringkat teratas di panel samping notifikasi.

Gunakan Notification.ProgressStyle untuk menata gaya notifikasi yang berfokus pada progres. Kasus penggunaan utamanya mencakup transportasi online, pengiriman, dan navigasi. Dalam class tersebut, Anda akan menemukan kemampuan untuk menunjukkan status dan tonggak pencapaian dalam perjalanan pengguna menggunakan Poin dan Segmen.

Class yang relevan

Class berikut berisi berbagai API yang Anda gunakan untuk membuat notifikasi ProgressStyle:

Anatomi dan penyesuaian

Gambar berikut menunjukkan berbagai bagian yang membentuk notifikasi ProgressStyle:

Gambar 2.Berbagai bagian 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.