Push​Notification​Channel Push​Notification​Channel Push​Notification​Channel Class

Definition

Represents a delivery vehicle and addressing mechanism for push notifications.

The channel Uniform Resource Identifier (URI)represented by this interface is used by a third-party application server to communicate with the Windows Push Notification Services (WNS). The push notification channel is used by the client to intercept notifications.

public : sealed class PushNotificationChannel : IPushNotificationChannelpublic sealed class PushNotificationChannel : IPushNotificationChannelPublic NotInheritable Class PushNotificationChannel Implements IPushNotificationChannel
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
internetClient

Remarks

This object is returned through an instance of the IAsyncOperation interface which is returned through the CreatePushNotificationChannelForApplicationAsync method. When the asynchronous operation completes successfully, it returns the PushNotificationChannel object through a then or done method.

Properties

ExpirationTime ExpirationTime ExpirationTime

Gets the time at which the channel expires. Notifications sent to this channel after this time are rejected.

public : DateTime ExpirationTime { get; }public DateTimeOffset ExpirationTime { get; }Public ReadOnly Property ExpirationTime As DateTimeOffset
Value
DateTime DateTimeOffset DateTimeOffset

The time at which the channel expires. Notifications sent to this channel after this time are rejected.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
internetClient

Remarks

To prevent a channel from expiring, apps should request a new push notification channel every time that the app is run.

An expired channel behaves as though it was closed. Because channels cannot be renewed, after a channel expires, a secondary tile or application must request a new push notification channel.

See Also

Uri Uri Uri

Gets the Uniform Resource Identifier (URI) to which an app server sends a push notification intended for an application or secondary tile bound to this channel. This Uniform Resource Identifier (URI) is transmitted to and stored by the third-party app server.

public : PlatForm::String Uri { get; }public string Uri { get; }Public ReadOnly Property Uri As string
Value
PlatForm::String string string

The Uniform Resource Identifier (URI) (https) that the app server uses to post notifications.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
internetClient
See Also

Methods

Close() Close() Close()

Explicitly invalidates this channel. Any notifications pushed to this channel after this method is called are not delivered.

public : void Close()public void Close()Public Function Close() As void
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
internetClient

Remarks

After it has been closed, the channel can never be used again. Channels that are closed through this method are no different than channels that have expired. To resume sending push notifications to this app, the app must request a new channel.

Calling Close on a channel invalidates the underlying URI as well as any non-expired, non-closed URIs previously created for the app.

See Also

Events

PushNotificationReceived PushNotificationReceived PushNotificationReceived

Fires when a push notification has arrived on this channel.

public : event TypedEventHandler PushNotificationReceivedpublic event TypedEventHandler PushNotificationReceivedPublic Event PushNotificationReceived
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
internetClient

Examples

The following example shows a listener for this event, which invokes the event handler.



function listeningForPushNotification() {

    if (channel) {

        channel.addEventListener("pushnotificationreceived", pushNotificationReceivedHandler);

}

Remarks

Windows Push Notification Services (WNS) sends this event only when the notification's target app is in the foreground. If the app is suspended, it does not receive the event.

See Also

See Also