PushNotificationReceivedEventArgs Class
Definition
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
- Inheritance
- Attributes
Windows requirements
Device family |
Windows 10 (introduced in 10.0.10240.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v1.0)
|
App capabilities |
internetClient
|
Examples
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;
}
Remarks
Your app receives this class when processing the PushNotificationReceived event.
Properties
BadgeNotification |
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. |
NotificationType |
Gets the type of push notification that has been received from the app server. |
RawNotification |
Gets the app-defined content contained in this push notification, the contents of which are used to perform a background task on the app. |
TileNotification |
Gets the content of a tile update to perform in response to this push notification. |
ToastNotification |
Gets the content of a toast to display in response to this push notification. |