[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Progress-centric notifications\n\nAndroid 16 introduces progress-centric notifications to help users seamlessly\ntrack user-initiated, start-to-end journeys.\n\n[`Notification.ProgressStyle`](/reference/android/app/Notification.ProgressStyle) is a new notification\nstyle that lets you create progress-centric notifications. Key use cases include\nrideshare, delivery, and navigation. Within the `Notification.ProgressStyle`\nclass, you can denote states and milestones in a user journey using\n[points](/reference/android/app/Notification.ProgressStyle.Point) and [segments](/reference/android/app/Notification.ProgressStyle.Segment). \nA progress-centric notification displayed on the lockscreen. \nA progress-centric notification displayed in the notification shade.\n\n#### Relevant classes and methods\n\nThe following classes contain the different APIs that you use to construct a\n`ProgressStyle` notification:\n\n- [`Notification.ProgressStyle`](/reference/android/app/Notification.ProgressStyle)\n- [`Notification.ProgressStyle.Point`](/reference/android/app/Notification.ProgressStyle.Point)\n- [`Notification.ProgressStyle.Segment`](/reference/android/app/Notification.ProgressStyle.Segment)\n\n#### Anatomy and customization\n\nThe following images show the different parts that make up `ProgressStyle`\nnotifications:\n\nThe following images show the different parts that make up `ProgressStyle`\nnotifications:\n\n|---------------------|---------------------------------------------------------------------------------------------------------------------------------|\n| A. Header - Subtext | [`Notification.Builder.setSubText()`](/reference/android/app/Notification.Builder#setSubText(java.lang.CharSequence)) |\n| B. Header - Time | [`Notification.Builder.setWhen()`](/reference/androidx/core/app/NotificationCompat.Builder#setWhen(long)) |\n| C. Content Title | [`Notification.Builder.setContentTitle()`](/reference/android/app/Notification.Builder#setContentTitle(java.lang.CharSequence)) |\n| D. Content Text | [`Notification.Builder.setContentText()`](/reference/android/app/Notification.Builder#setContentText(java.lang.CharSequence)) |\n| E. Progress bar | [`Notification.ProgressStyle`](/reference/android/app/Notification.ProgressStyle) |\n| F. Action button | [`Notification.Builder.addAction()`](/reference/android/app/Notification.Builder#addAction(android.app.Notification.Action)) |\n\nApps can set a vehicle image for the tracker icon and use segments and points to denote the rideshare experience and milestones.\n\n### Best practices\n\nAdhere to the following best practices to help provide the best possible user\nexperience with progress-centric notifications:\n\n- Ensure the right fields are set to meet [promoted\n visibility](/develop/ui/views/notifications#promoted-visibility).\n- Use the right visual elements to guide the user in their journey. For example, rideshare apps should set a vehicle image and the most accurate color of the vehicle being used in a rideshare experience using [`Notification.setLargeIcon()`](/reference/androidx/core/app/NotificationCompat.Builder#setLargeIcon(android.graphics.drawable.Icon))\n- Use concise and clear language to define the progress of that user journey. Time of arrival, driver name, and state of journey are critical text that should be communicated in the notification.\n- Provide useful and relevant [actions](/reference/android/app/Notification.Builder#addAction(android.app.Notification.Action)) in the notification that will help streamline the user journey. For example, providing a tip or adding an additional dish to a newly-initiated order for food delivery are actionable items prior to its delivery.\n- Use [segments](/reference/android/app/Notification.ProgressStyle.Segment) and [points](/reference/android/app/Notification.ProgressStyle.Point) to denote states. For example, use segments to colorize a state and duration of traffic in a rideshare journey, and use points for states for milestones, food preparation, delivery, and passenger pick-up.\n- [Update the progress experience](/develop/ui/views/notifications/build-notification#Updating) frequently and accurately to match the actual progression of the journey. For example, traffic conditions that change can be reflected in changes in segment colors and updates in text.\n\nThe following code snippet shows how a `ProgressStyle` notification could be\nused for a rideshare context: \n\n var ps =\n Notification.ProgressStyle()\n .setStyledByProgress(false)\n .setProgress(456)\n .setProgressTrackerIcon(Icon.createWithResource(appContext, R.drawable.ic_car_red))\n .setProgressSegments(\n listOf(\n Notification.ProgressStyle.Segment(41).setColor(Color.BLACK),\n Notification.ProgressStyle.Segment(552).setColor(Color.YELLOW),\n Notification.ProgressStyle.Segment(253).setColor(Color.WHITE),\n Notification.ProgressStyle.Segment(94).setColor(Color.BLUE)\n )\n )\n .setProgressPoints(\n listOf(\n Notification.ProgressStyle.Point(60).setColor(Color.RED),\n Notification.ProgressStyle.Point(560).setColor(Color.GREEN)\n )\n )\n\nNote that in the example, a vehicle image is set for the tracker icon, and\nsegments and points are used to denote the rideshare experience and milestones\nto provide a more complete user experience.\n\nCheck out the [sample app](https://github.com/android/platform-samples/tree/main/samples/user-interface/live-updates) for more information."]]