PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync Method
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.
Overloads
CreatePushNotificationChannelForApplicationAsync() |
Creates an object, bound to the calling app, through which you retrieve a push notification channel from Windows Push Notification Services (WNS). |
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. |
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();
/// [Windows.Foundation.Metadata.Overload("CreatePushNotificationChannelForApplicationAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
static IAsyncOperation<PushNotificationChannel> CreatePushNotificationChannelForApplicationAsync();
[Windows.Foundation.Metadata.Overload("CreatePushNotificationChannelForApplicationAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<PushNotificationChannel> CreatePushNotificationChannelForApplicationAsync();
function createPushNotificationChannelForApplicationAsync()
Public Shared Function CreatePushNotificationChannelForApplicationAsync () As IAsyncOperation(Of PushNotificationChannel)
Returns
The object, bound to the calling app, that is used to request a PushNotificationChannel from the Windows Push Notification Services (WNS).
- Attributes
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.
See also
- CreatePushNotificationChannelForApplicationAsync(String)
- Windows Push Notification Services (WNS) overview
- Push and periodic notifications sample (archived)
- Quickstart: Sending a push notification
- How to request, create, and save a notification channel
- Push notification service request and response headers
Applies to
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);
/// [Windows.Foundation.Metadata.Overload("CreatePushNotificationChannelForApplicationAsyncWithId")]
/// [Windows.Foundation.Metadata.RemoteAsync]
static IAsyncOperation<PushNotificationChannel> CreatePushNotificationChannelForApplicationAsync(winrt::hstring const& applicationId);
[Windows.Foundation.Metadata.Overload("CreatePushNotificationChannelForApplicationAsyncWithId")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<PushNotificationChannel> CreatePushNotificationChannelForApplicationAsync(string applicationId);
function createPushNotificationChannelForApplicationAsync(applicationId)
Public Shared Function CreatePushNotificationChannelForApplicationAsync (applicationId As String) As IAsyncOperation(Of PushNotificationChannel)
Parameters
- applicationId
-
String
Platform::String
winrt::hstring
The package-relative application identifier (PRAID) of the app to bind to the push notification channel. The specified app must be in the same package as the calling app. For more info on the PRAID, see the Id attribute of the Application element.
If you are hosting background task(s) in an out-of-process COM server, separate from your main application, then pass as the argument for applicationId
the PRAID of the application that defines the windows.backgroundTask
extension in its own package manifest.
Returns
The object, bound to the app specified in applicationId, that is used to request a PushNotificationChannel from the Windows Push Notification Services (WNS).
- Attributes
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.
See also
- CreatePushNotificationChannelForApplicationAsync()
- Windows Push Notification Services (WNS) overview
- Push and periodic notifications sample (archived)
- 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