Notification.Builder.SetShortcutId(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
From Android 11, messaging notifications (those that use MessagingStyle) that use this method to link to a published long-lived sharing shortcut may appear in a dedicated Conversation section of the shade and may show configuration options that are unique to conversations.
[Android.Runtime.Register("setShortcutId", "(Ljava/lang/String;)Landroid/app/Notification$Builder;", "GetSetShortcutId_Ljava_lang_String_Handler", ApiSince=26)]
public virtual Android.App.Notification.Builder SetShortcutId(string? shortcutId);
[<Android.Runtime.Register("setShortcutId", "(Ljava/lang/String;)Landroid/app/Notification$Builder;", "GetSetShortcutId_Ljava_lang_String_Handler", ApiSince=26)>]
abstract member SetShortcutId : string -> Android.App.Notification.Builder
override this.SetShortcutId : string -> Android.App.Notification.Builder
Parameters
- shortcutId
- String
String: the id of the shortcut this notification is linked to
Returns
This Android.App.Notification.Builder instance, allowing calls to be chained.
- Attributes
Remarks
From Android 11, messaging notifications (those that use MessagingStyle) that use this method to link to a published long-lived sharing shortcut may appear in a dedicated Conversation section of the shade and may show configuration options that are unique to conversations. This behavior should be reserved for person to person(s) conversations where there is a likely social obligation for an individual to respond. For example, the following are some examples of notifications that belong in the conversation space: 1:1 conversations between two individuals Group conversations between individuals where everyone can contribute And the following are some examples of notifications that do not belong in the conversation space: Advertisements from a bot (even if personal and contextualized) Engagement notifications from a bot Directional conversations where there is an active speaker and many passive individuals Stream / posting updates from other individuals Email, document comments, or other conversation types that are not real-time
Additionally, this method can be used for all types of notifications to mark this notification as duplicative of a Launcher shortcut. Launchers that show badges or notification content may then suppress the shortcut in favor of the content of this notification. If this notification has BubbleMetadata attached that was created with a shortcutId a check will be performed to ensure the shortcutId supplied to bubble metadata matches the shortcutId set here, if one was set. If the shortcutId's were specified but do not match, an exception is thrown.
See also:
Android reference for android.app.Notification.Builder.setShortcutId.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.