PushNotificationChannel
PushNotificationChannel
PushNotificationChannel
PushNotificationChannel
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// You can use this class in JavaScript.
- Attributes
| 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 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// You can use this property in JavaScript.
- Value
- DateTime DateTimeOffset DateTimeOffset DateTimeOffset
The time at which the channel expires. Notifications sent to this channel after this time are rejected.
| 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 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// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The Uniform Resource Identifier (URI) (https) that the app server uses to post notifications.
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
| Capabilities |
internetClient
|
- See Also
-
Methods
Close() 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// You can use this method in JavaScript.
| 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 PushNotificationReceived
Fires when a push notification has arrived on this channel.
public : event TypedEventHandler PushNotificationReceived<PushNotificationChannel, PushNotificationReceivedEventArgs>public event TypedEventHandler PushNotificationReceived<PushNotificationChannel, PushNotificationReceivedEventArgs>Public Event PushNotificationReceived<PushNotificationChannel, PushNotificationReceivedEventArgs>// You can use this event in JavaScript.
| 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
- Windows Push Notification Services (WNS) overview
- Push and periodic notifications sample
- Quickstart: Sending a tile push notification
- Quickstart: Sending a toast push notification
- How to update a badge through push notifications
- How to authenticate with the Windows Push Notification Service (WNS)
- How to request, create, and save a notification channel
- Guidelines and checklist for push notifications
- Push notification service request and response headers