Share via


PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync Method

Definition

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

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

Applies to