ChatMessageNotificationTriggerDetails ChatMessageNotificationTriggerDetails ChatMessageNotificationTriggerDetails ChatMessageNotificationTriggerDetails Class

Definition

Represents the message notification triggered from a registered background task. A chat app can receive notifications of incoming messages or send events by setting a task trigger and task entry point.

public : sealed class ChatMessageNotificationTriggerDetails : IChatMessageNotificationTriggerDetails, IChatMessageNotificationTriggerDetails2public sealed class ChatMessageNotificationTriggerDetails : IChatMessageNotificationTriggerDetails, IChatMessageNotificationTriggerDetails2Public NotInheritable Class ChatMessageNotificationTriggerDetails Implements IChatMessageNotificationTriggerDetails, IChatMessageNotificationTriggerDetails2// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

A chat app must register a background task to process notifications in order to serve as the default handler for incoming messages. In order to register a background task, the app manifest must contain a background task extension like the following example.

<Extension Category=”windows.backgroundTasks” Entry-Point=”Tasks.ExampleBackgroundTask>”
  <BackgroundTasks>
    <Task Type=”chatMessageNotification”/>
    <Task Type=”systemEvent”/>
  </BackgroundTask>
</Extension>

The background task’s Run method receives a task instance with the notification trigger details. The TriggerDetails property is cast to a ChatMessageNotificationTriggerDetails object. The trigger details for a chat message are obtained as shown in the following example.

public void Run(IBackgroundTaskInstance taskInstance)
{
    BackgroundTaskDeferral deferral = taskInstance.GetDeferral();
    ChatMessageNotificationTriggerDetails triggerDetails =
        (ChatMessageNotificationTriggerDetails) taskInstance.TriggerDetails;

    if (triggerDetails != null)
    {
        SendToast(triggerDetails.ChatMessage);
    }
}

Properties

ChatMessage ChatMessage ChatMessage ChatMessage

Gets the message associated with the notification. This is either an incoming message or an outgoing message with a send status event.

public : ChatMessage ChatMessage { get; }public ChatMessage ChatMessage { get; }Public ReadOnly Property ChatMessage As ChatMessage// You can use this property in JavaScript.
Value
ChatMessage ChatMessage ChatMessage ChatMessage

The chat message associated with the trigger.

ShouldDisplayToast ShouldDisplayToast ShouldDisplayToast ShouldDisplayToast

Gets a Boolean value indicating if the background task should issue a toast notification for the message.

public : PlatForm::Boolean ShouldDisplayToast { get; }public bool ShouldDisplayToast { get; }Public ReadOnly Property ShouldDisplayToast As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

A Boolean value indicating if the background task should issue a toast notification for the message.

ShouldUpdateActionCenter ShouldUpdateActionCenter ShouldUpdateActionCenter ShouldUpdateActionCenter

Gets a Boolean value indicating if the Windows Action Center should be updated with the message.

public : PlatForm::Boolean ShouldUpdateActionCenter { get; }public bool ShouldUpdateActionCenter { get; }Public ReadOnly Property ShouldUpdateActionCenter As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

A Boolean value indicating if the Windows Action Center should be updated.

ShouldUpdateBadge ShouldUpdateBadge ShouldUpdateBadge ShouldUpdateBadge

Gets a Boolean value indicating if the background task should update the app’s lock screen count.

public : PlatForm::Boolean ShouldUpdateBadge { get; }public bool ShouldUpdateBadge { get; }Public ReadOnly Property ShouldUpdateBadge As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

A Boolean value indicating if the background task should update the app’s lock screen count.

ShouldUpdateDetailText ShouldUpdateDetailText ShouldUpdateDetailText ShouldUpdateDetailText

Gets a Boolean value indicating that the background task should update the app's tile count for the message.

public : PlatForm::Boolean ShouldUpdateDetailText { get; }public bool ShouldUpdateDetailText { get; }Public ReadOnly Property ShouldUpdateDetailText As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

A Boolean value indicating that the background task should update the app's tile count for the message.