AppNotificationBuilder.IsUrgentScenarioSupported Method

Definition

Returns a value indicating whether the urgent app notification scenario is supported on the current device.

public:
 static bool IsUrgentScenarioSupported();
 static bool IsUrgentScenarioSupported();
public static bool IsUrgentScenarioSupported();
function isUrgentScenarioSupported()
Public Shared Function IsUrgentScenarioSupported () As Boolean

Returns

Boolean

bool

True if the current device supports the urgent app notification scenario; otherwise, false.

Examples

The following example demonstrates checking to see if the urgent app notification scenario is supported.

var builder = new AppNotificationBuilder()
    .AddText("Notification text.");

if (AppNotificationBuilder.IsUrgentScenarioSupported())
{
    builder.SetScenario(AppNotificationScenario.Urgent);
}

AppNotificationManager.Default.Show(builder.BuildNotification());

The resulting XML payload if the urgent scenario is supported:

<toast scenario='urgent'>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
</toast>

Remarks

The AppNotificationBuilder.SetScenario method allows you to specify one of the scenarios from the AppNotificationScenario enumeration which causes the system to adjust some of the notification behaviors to present a consistent experience for the specified scenario. The Urgent scenario value is only supported for on Windows 10 Build 19041 and later. This method allows you to determine at runtime if the urgent scenario is supported on the current device.

For guidance on using the AppNotificationBuilder APIs to create the UI for app notifications, see App notification content.

For reference information about the XML schema for app notifications, see App notification content schema.

Applies to