[null,null,["最后更新时间 (UTC):2025-08-21。"],[],[],null,["# Create a Live Update notification\n\nThe system promotes Live Update notifications. Promoted notifications appear\nmore prominently on system surfaces, including at the top of the notification\ndrawer and the lock screen, and as a chip in the status bar.\n**Figure 1.** An example of a Live Update notification.\n\nPromoted notification cards have the following appearance characteristics:\n\n- Expanded by default\n- Uncollapsible\n\nYour notification must meet the following requirements to qualify as a live\nupdate:\n\n- Must be Standard/No Style, [`BigTextStyle`](/reference/android/app/Notification.BigTextStyle), [`CallStyle`](/reference/android/app/Notification.CallStyle), or [`ProgressStyle`](/reference/android/app/Notification.ProgressStyle).\n- Must request the following non-runtime permission in the android manifest `android.permission.POST_PROMOTED_NOTIFICATIONS`.\n- Must request promotion using `EXTRA_REQUEST_PROMOTED_ONGOING` or `NotificationCompat.Builder#requestPromotedOngoing`.\n- Must be [`ongoing`](/reference/android/app/Notification.Builder#setOngoing(boolean)) (set [`FLAG_ONGOING_EVENT`](/reference/android/app/Notification.Builder#setOngoing(boolean)))).\n- Must have a `contentTitle` set.\n- Must **NOT** have any [`customContentView`](/reference/android/app/Notification.Builder#setCustomContentView(android.widget.RemoteViews)) set (no `RemoteViews`).\n- Must **NOT** be the summary of a group using [`setGroupSummary`](/reference/android/app/Notification.Builder#setGroupSummary(boolean)).\n- Must **NOT** [`setColorized`](/reference/android/app/Notification.Builder#setColorized(boolean)) to `TRUE`.\n- The notification channel must **NOT** have [`IMPORTANCE_MIN`](/reference/android/app/NotificationManager#IMPORTANCE_MIN).\n\nPromotion characteristics\n-------------------------\n\nThe following APIs help you determine whether the system will promote your\nnotification:\n\n- `Notification.FLAG_PROMOTED_ONGOING` indicates whether the notification is promoted.\n- `Notification.hasPromotableCharacteristics()` validates whether the system can promote the notification. This method does not consider whether the user disabled Live Updates for the app in settings.\n- `NotificationManager.canPostPromotedNotifications()` checks whether your app can post a promoted notification, for example, if the user enabled or disabled it in settings.\n- `Settings.ACTION_MANAGE_APP_PROMOTED_NOTIFICATIONS` is the intent action that allows apps to send users to Settings to enable this feature.\n\n| **Note:** Original Equipment Manufacturers (OEMs) can enforce additional criteria for Live update eligibility. Check their respective documentation for details.\n\nUsage criteria\n--------------\n\nUse Live Updates for activities that are ongoing, user-initiated and time\nsensitive.\n\n### Ongoing\n\nA Live Update must represent an activity that is actively in progress, with a\ndistinct start and end. If an activity occurs in the past, don't use a Live\nUpdate. Instead, use a standard notification. This is also true for events that\nhave not yet begun, although events that are about to start can use a Live\nUpdate.\n\nLive Updates represent ongoing activities. Don't use Live Updates to offer\naccelerated access to app functionality. If you want to do this, use an app\nwidget or a custom Quick Settings tile.\n\n- **Appropriate uses:** Active navigation, ongoing phone calls, active rideshare tracking, and active food delivery tracking.\n- **Inappropriate uses:** Ads, promotions, chat messages, alerts, upcoming calendar events, and quick access to app features.\n\n### User-initiated\n\nMost Live Updates should represent activities that are explicitly triggered by\nthe user, such as starting a workout, initiating driving navigation, or hailing\na rideshare. Don't show ambient information, such as that about the user's\nenvironment, interests, or upcoming events, in a Live Update. Don't allow\nactivities triggered by other parties to generate Live Updates.\n\nSometimes, a user might perform an action that initiates an activity for some\ntime in the future. For example, if the user purchases tickets for a flight or\nconcert, signs up for a tournament, or otherwise indicates their future\nattendance to a time-sensitive event. In these cases, it may be appropriate to\nautomatically show a Live Update when the scheduled event begins. However, apps\nmust tune their triggers to only appear when the activity is imminent. If the\nuser explicitly indicates that they want to begin monitoring a background event\nsuch as a sports game, you can begin posting Live Updates for that event.\nHowever, you should also include an **Unpin** action in the associated\nnotification.\n\n### Time Sensitive\n\nShow a Live Update only if it requires the user's attention throughout the\nactivity. A key use case for Live Updates is monitoring, when the user gets\nsignificant benefit from glancing at the Live Update to keep an eye on the\nevolving state of the activity.\n\nA Live Update is often appropriate for activities that transition between Live\nUpdates and normal notifications. For example, showing a boarding pass\nnotification is appropriate many hours before a user's flight, but the\nnotification should become a Live Update only when the user has a pressing need,\nsuch as when they have arrived at the airport or venue or once boarding has\nbegun. In contrast, a Live Update isn't appropriate for tracking a package as\nthe user doesn't need to constantly monitor this.\n\nStatus Chips\n------------\n\nStatus chips allow users to keep track of Live Updates when the notification is\nnot in view. Use [`setShortCriticalText`](/reference/android/app/Notification.Builder#setShortCriticalText(java.lang.String)) or [`setWhen`](/reference/android/app/Notification.Builder#setWhen(long)) to convey\nimportant state information regarding your progress centric notification.\n**Figure 2.** Indeterminate state displays the small icon, `Notification.Builder#setSmallIcon`. **Figure 3.** Use `Notification.Builder#setShortCriticalText` to show absolute time. **Figure 4.** Use `Notification.Builder#setShortCriticalText` to convey critical information.\n\n### When time\n\nThe when time triggers a countdown for the longevity of the notification, unless\nthe notification is dismissed or updated.\n\n- The when time is at least 2 minutes in the future: if the current time is 10:05 am and the when time is set to 10:10 am, then the chip will say \"5min\".\n- If the when time is more than 1 minute in the past the notification isn't shown.\n- Use [`setShowWhen`](/reference/android/app/Notification.Builder#setShowWhen(boolean)) to `FALSE` if you don't want the notification shown in the shade to have a time.\n\n### Status chip appearance\n\nThe status chip always includes an icon, and optionally includes text. The chip\nhas a maximum width of 96dp. Show the text depending on the following criteria:\n\n- If less than 7 characters, show the whole text.\n- If less than half of the text will display, show the icon only.\n- If more than half of the text will display, show as much text as possible.\n\nDismissal\n---------\n\nUsers can control notification visibility in the notification shade. Posting\nunwanted Live Updates might cause users to revoke an app's posting permission.\n\nTo prevent users from completely disabling Live Updates, avoid posting updates\nthat users might dismiss. Don't repost Live Updates that the user dismissed. Use\n`setDeleteIntent` to detect dismissed updates.\n\nSee the [sample app](https://github.com/android/platform-samples/tree/main/samples/user-interface/live-updates) to experiment with these APIs."]]