Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
Encapsulates a push notification that has been received from the app server, identifying the type and supplying the content of the notification. Windows passes this information in the PushNotificationReceived event.
public ref class PushNotificationReceivedEventArgs sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class PushNotificationReceivedEventArgs final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class PushNotificationReceivedEventArgs final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class PushNotificationReceivedEventArgs
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class PushNotificationReceivedEventArgs
Public NotInheritable Class PushNotificationReceivedEventArgs
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
App capabilities |
internetClient
|
The following example shows the members of this class in use.
function listeningForPushNotification() {
if (channel) {
channel.addEventListener("pushnotificationreceived", pushNotificationReceivedHandler);
}
function pushNotificationReceivedHandler(e) {
var notificationTypeName = "";
var notificationPayload;
switch (e.notificationType) {
// You can get the toast, tile, or badge notification object.
// In this example, we take the XML from the notification.
case pushNotifications.PushNotificationType.toast:
notificationTypeName = "Toast";
notificationPayload = e.toastNotification.content.getXml();
break;
case pushNotifications.PushNotificationType.tile:
notificationTypeName = "Tile";
notificationPayload = e.tileNotification.content.getXml();
break;
case pushNotifications.PushNotificationType.badge:
notificationTypeName = "Badge";
notificationPayload = e.badgeNotification.content.getXml();
break;
}
e.cancel = true;
}
Your app receives this class when processing the PushNotificationReceived event.
Badge |
Gets the content of a badge update to perform in response to this push notification. |
Cancel |
Gets or sets whether Windows should perform its default handling of the notification. |
Notification |
Gets the type of push notification that has been received from the app server. |
Raw |
Gets the app-defined content contained in this push notification, the contents of which are used to perform a background task on the app. |
Tile |
Gets the content of a tile update to perform in response to this push notification. |
Toast |
Gets the content of a toast to display in response to this push notification. |
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in