Skip to content

Latest commit

 

History

History
59 lines (38 loc) · 2.22 KB

appnotificationbuilder_isurgentscenariosupported_491113719.md

File metadata and controls

59 lines (38 loc) · 2.22 KB
-api-id -api-type
M:Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilder.IsUrgentScenarioSupported
winrt method

Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilder.IsUrgentScenarioSupported

-description

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

-returns

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

-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.

-see-also

-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>