Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 1.86 KB

appnotificationbuilder_muteaudio_1363608255.md

File metadata and controls

55 lines (37 loc) · 1.86 KB
-api-id -api-type
M:Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilder.MuteAudio
winrt method

Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilder.MuteAudio

-description

Requests that the system mute any audio associated with the app notification.

-returns

Returns the AppNotificationBuilder instance so that additional method calls can be chained.

-remarks

To specify the audio for an app notification, use xref:Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilder.SetAudioEvent(Microsoft.Windows.AppNotifications.Builder.AppNotificationSoundEvent,Microsoft.Windows.AppNotifications.Builder.AppNotificationAudioLooping) or xref:Microsoft.Windows.AppNotifications.Builder.AppNotificationBuilder.SetAudioUri(Windows.Foundation.Uri,Microsoft.Windows.AppNotifications.Builder.AppNotificationAudioLooping).

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 requesting audio muting in the XML payload for an app notification.

var notification = new AppNotificationBuilder()
    .AddText("Notification text.")
    .MuteAudio()
    .BuildNotification();

AppNotificationManager.Default.Show(notification);

The resulting XML payload:

<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Notification text.</text>
        </binding>
    </visual>
    <audio silent='true'/>
</toast>