Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
In Android 16 werden nutzungsorientierte Benachrichtigungen eingeführt, mit denen Nutzer den Fortschritt von von ihnen initiierten Abläufen von Anfang bis Ende verfolgen können.
Notification.ProgressStyle ist ein neuer Benachrichtigungsstil, mit dem Sie fortschrittsorientierte Benachrichtigungen erstellen können. Zu den wichtigsten Anwendungsfällen gehören Ridesharing, Lieferservice und Navigation. Innerhalb der Klasse Notification.ProgressStyle können Sie Zustände und Meilensteine in einer User Journey mithilfe von Punkten und Segmenten angeben.
Eine schrittweise Benachrichtigung, die auf dem Sperrbildschirm angezeigt wird.
Eine benachrichtigungsorientierte Benachrichtigung, die in der Benachrichtigungsleiste angezeigt wird.
Relevante Klassen und Methoden
Die folgenden Klassen enthalten die verschiedenen APIs, mit denen du eine ProgressStyle-Benachrichtigung erstellst:
Apps können ein Fahrzeugbild für das Trackersymbol festlegen und Segmente und Punkte verwenden, um die Nutzung von Ridesharing und Meilensteine anzugeben.
Best Practices
Beachten Sie die folgenden Best Practices, um Nutzern mit nutzungsorientierten Benachrichtigungen die bestmögliche Nutzererfahrung zu bieten:
Verwenden Sie die richtigen visuellen Elemente, um die Nutzer durch den Kaufprozess zu leiten. So sollten beispielsweise Rideshare-Apps ein Fahrzeugbild und die möglichst genaue Farbe des Fahrzeugs festlegen, das für die Fahrt verwendet wird. Verwenden Sie dazu Notification.setLargeIcon().
Beschreiben Sie den Fortschritt dieses Kaufprozesses in einer prägnanten und klaren Sprache.
Ankunftszeit, Name des Fahrers und Fahrtstatus sind wichtige Informationen, die in der Benachrichtigung enthalten sein sollten.
Bieten Sie in der Benachrichtigung nützliche und relevante Aktionen an, die die User Journey optimieren. Beispiele für Aktionen vor der Lieferung sind das Geben eines Trinkgelds oder das Hinzufügen eines zusätzlichen Gerichts zu einer neu aufgegebenen Bestellung für die Lieferung von Lebensmitteln.
Verwenden Sie Segmente und Punkte, um Zustände anzugeben. Sie können beispielsweise Segmente verwenden, um den Status und die Dauer von Staus bei einer Fahrt mit einem Mitfahrdienst zu färben, und Punkte für Status für Meilensteine, die Zubereitung von Speisen, die Lieferung und die Abholung von Fahrgästen.
Aktualisieren Sie den Fortschritt häufig und genau, damit er dem tatsächlichen Fortschritt der Fahrt entspricht. So können sich beispielsweise sich ändernde Verkehrsbedingungen in Änderungen der Segmentfarben und Aktualisierungen im Text widerspiegeln.
Das folgende Code-Snippet zeigt, wie eine ProgressStyle-Benachrichtigung für einen Kontext für Fahrgemeinschaften verwendet werden könnte:
Beachten Sie, dass in diesem Beispiel ein Fahrzeugbild für das Trackersymbol festgelegt ist und Segmente und Punkte verwendet werden, um die Fahrtenoption und Meilensteine zu kennzeichnen, um eine umfassendere Nutzererfahrung zu bieten.
Weitere Informationen finden Sie in der Beispiel-App.
Alle Inhalte und Codebeispiele auf dieser Seite unterliegen den Lizenzen wie im Abschnitt Inhaltslizenz beschrieben. Java und OpenJDK sind Marken oder eingetragene Marken von Oracle und/oder seinen Tochtergesellschaften.
Zuletzt aktualisiert: 2025-07-27 (UTC).
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-07-27 (UTC)."],[],[],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."]]