קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
ב-Android 16 נוספו התראות שמתמקדות בהתקדמות, כדי לעזור למשתמשים לעקוב בצורה חלקה אחרי תהליכים שהם יזמו, מתחילתו ועד סופו.
Notification.ProgressStyle הוא סגנון התראות חדש שמאפשר ליצור התראות שמתמקדות בהתקדמות. תרחישי שימוש עיקריים כוללים שיתוף נסיעות, משלוחים וניווט. בתוך הכיתה Notification.ProgressStyle אפשר לציין מצבים ואבני דרך בתהליך השימוש של המשתמש באמצעות נקודות ופלחים.
התראה שמתמקדת בהתקדמות מוצגת במסך הנעילה.
התראה שמתמקדת בהתקדמות מוצגת בחלונית ההתראות.
שיטות וכיתות רלוונטיות
הכיתות הבאות מכילות את ממשקי ה-API השונים שבהם משתמשים כדי ליצור התראה מסוג ProgressStyle:
השתמשו באלמנטים החזותיים המתאימים כדי להנחות את המשתמש בתהליך. לדוגמה, אפליקציות של שירותי שיתוף נסיעות צריכות להגדיר תמונה של הרכב ואת הצבע המדויק ביותר של הרכב שבו נעשה שימוש בחוויית שיתוף הנסיעה באמצעות Notification.setLargeIcon()
השתמשו בשפה תמציתית וברורה כדי להגדיר את ההתקדמות בתהליך שהמשתמש עובר.
זמן ההגעה, שם הנהג והסטטוס של הנסיעה הם טקסטים קריטיים שצריך לציין בהתראה.
כדאי לספק פעולות מועילות ורלוונטיות בהתראה, שיעזרו לייעל את תהליך השימוש של המשתמש. לדוגמה, אפשר להוסיף טיפ או להוסיף מנה להזמנה חדשה של משלוח מזון לפני שהיא תימסר.
משתמשים בפלחים ובנקודות כדי לציין מצבים. לדוגמה, אפשר להשתמש בפלחים כדי לצבוע מצב ומשך זמן של תנועה במסלול נסיעה בשירות שיתוף נסיעות, ולהשתמש בנקודות למצבים של ציוני דרך, הכנת מזון, מסירה ואיסוף נוסעים.
לעדכן את חוויית ההתקדמות בתדירות גבוהה ובאופן מדויק, כך שתתאים להתקדמות בפועל של התהליך. לדוגמה, שינויים בתנאי התנועה יכולים לגרום לשינויים בצבעי הקטעים ולעדכונים בטקסט.
בקטע הקוד הבא מוצג איך אפשר להשתמש בהתראה ProgressStyle בהקשר של נסיעה משותפת:
שימו לב שבדוגמה, תמונה של רכב מוגדרת לסמל המעקב, ונעשה שימוש בקטעים ובנקודות כדי לציין את חוויית הנסיעה המשותפת ואת אבני הדרך, וכך לספק חוויית משתמש מלאה יותר.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[null,null,["עדכון אחרון: 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."]]