PushNotificationChannelManager
PushNotificationChannelManager
PushNotificationChannelManager
PushNotificationChannelManager
Class
Definition
Creates objects that you use to retrieve push notification channels from the Windows Push Notification Services (WNS). These channels are bound to an app or secondary tile.
public : static class PushNotificationChannelManagerpublic static class PushNotificationChannelManagerPublic Static Class PushNotificationChannelManager// 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
|
Examples
The following example shows the use of the CreatePushNotificationChannelForApplicationAsync method to retrieve a push notification channel for the calling app.
var pushNotifications = Windows.Networking.PushNotifications;
var channel;
function openNotificationsChannel() {
var channelOperation = pushNotifications.PushNotificationChannelManager.createPushNotificationChannelForApplicationAsync();
return channelOperation.then(function (newChannel) {
channel = newChannel;
}
);
The following example shows the use of the CreatePushNotificationChannelForSecondaryTileAsync method to retrieve a push notification channel for a secondary tile.
var pushNotifications = Windows.Networking.PushNotifications;
var channel;
pushNotifications.PushNotificationChannelManager.createPushNotificationChannelForSecondaryTileAsync(myTileId).then(function (channel) {
// Your code here.
})
Methods
CreatePushNotificationChannelForApplicationAsync() CreatePushNotificationChannelForApplicationAsync() CreatePushNotificationChannelForApplicationAsync() CreatePushNotificationChannelForApplicationAsync()
Creates an object, bound to the calling app, through which you retrieve a push notification channel from Windows Push Notification Services (WNS).
public : static IAsyncOperation<PushNotificationChannel> CreatePushNotificationChannelForApplicationAsync()public static IAsyncOperation<PushNotificationChannel> CreatePushNotificationChannelForApplicationAsync()Public Static Function CreatePushNotificationChannelForApplicationAsync() As IAsyncOperation( Of PushNotificationChannel )// You can use this method in JavaScript.
The object, bound to the calling app, that is used to request a PushNotificationChannel from the Windows Push Notification Services (WNS).
Examples
The following example shows the use of this method to retrieve a channel for the calling app.
var pushNotifications = Windows.Networking.PushNotifications;
var channel;
function openNotificationsChannel() {
var channelOperation = pushNotifications.PushNotificationChannelManager.createPushNotificationChannelForApplicationAsync();
return channelOperation.then(function (newChannel) {
channel = newChannel;
}
);
Remarks
Tile update, toast, and badge notifications that arrive on this channel are delivered to the app's main or default tile.
An exception is thrown if you attempt to register a WNS push notification channel when there is no data connection. For a list of error codes that can be received, see CreatePushNotificationChannelForApplicationAsync.
CreatePushNotificationChannelForApplicationAsync(String) CreatePushNotificationChannelForApplicationAsync(String) CreatePushNotificationChannelForApplicationAsync(String) CreatePushNotificationChannelForApplicationAsync(String)
Creates an object, bound to a specified app, through which you retrieve a push notification channel from Windows Push Notification Services (WNS). The specified app must be in the same package as the calling app. This overload should only be called from a multi-app package, most apps should use the method with no parameter.
public : static IAsyncOperation<PushNotificationChannel> CreatePushNotificationChannelForApplicationAsync(PlatForm::String applicationId)public static IAsyncOperation<PushNotificationChannel> CreatePushNotificationChannelForApplicationAsync(String applicationId)Public Static Function CreatePushNotificationChannelForApplicationAsync(applicationId As String) As IAsyncOperation( Of PushNotificationChannel )// You can use this method in JavaScript.
- applicationId
- PlatForm::String String String String
The Package Relative Application ID (PRAID) of the app to bind to the push notification channel.
The object, bound to the app specified in applicationId, that is used to request a PushNotificationChannel from the Windows Push Notification Services (WNS).
Remarks
Tile update, toast, and badge notifications that arrive on this channel are delivered to the app's main or default tile.
An exception is thrown if you attempt to register a WNS push notification channel when there is no data connection. For a list of error codes that can be received, see CreatePushNotificationChannelForApplicationAsync.
CreatePushNotificationChannelForSecondaryTileAsync(String) CreatePushNotificationChannelForSecondaryTileAsync(String) CreatePushNotificationChannelForSecondaryTileAsync(String) CreatePushNotificationChannelForSecondaryTileAsync(String)
Creates an object, bound to a secondary tile, through which you retrieve a push notification channel from Windows Push Notification Services (WNS). The tile can be a secondary tile of the calling app or any other app in the same package.
public : static IAsyncOperation<PushNotificationChannel> CreatePushNotificationChannelForSecondaryTileAsync(PlatForm::String tileId)public static IAsyncOperation<PushNotificationChannel> CreatePushNotificationChannelForSecondaryTileAsync(String tileId)Public Static Function CreatePushNotificationChannelForSecondaryTileAsync(tileId As String) As IAsyncOperation( Of PushNotificationChannel )// You can use this method in JavaScript.
- tileId
- PlatForm::String String String String
The ID of the secondary tile to bind to the push notification channel.
The object, bound to the secondary tile, that is used to request a PushNotificationChannel from the Windows Push Notification Services (WNS).
Examples
This example shows the use of this method to retrieve a push notification channel for a secondary tile.
var pushNotifications = Windows.Networking.PushNotifications;
var channel;
pushNotifications.PushNotificationChannelManager.createPushNotificationChannelForSecondaryTileAsync(myTileId).then(function (channel) {
// Your code here.
})
Remarks
Note
Channels bound to secondary tiles only accept push notifications for Tile and Badge update types.
- See Also
-
GetDefault() GetDefault() GetDefault() GetDefault()
Gets the manager for the active user.
public : static PushNotificationChannelManagerForUser GetDefault()public static PushNotificationChannelManagerForUser GetDefault()Public Static Function GetDefault() As PushNotificationChannelManagerForUser// You can use this method in JavaScript.
A PushNotificationChannelManagerForUser object.
| Device family |
Windows 10 Creators Update (introduced v10.0.15063.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v4)
|
| Capabilities |
internetClient
|
GetForUser(User) GetForUser(User) GetForUser(User) GetForUser(User)
Gets the push notifications for the specified user.
public : static PushNotificationChannelManagerForUser GetForUser(User user)public static PushNotificationChannelManagerForUser GetForUser(User user)Public Static Function GetForUser(user As User) As PushNotificationChannelManagerForUser// You can use this method in JavaScript.
A PushNotificationChannelManagerForUser object.
| Device family |
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v3)
|
| Capabilities |
internetClient
|
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