PushNotificationChannelManagerForUser 類別

定義

建立用來從 Windows 推播通知服務擷取推播通知通道的物件, (WNS) 。 這些通道會透過應用程式或 次要磚系結至目前的使用者。

public ref class PushNotificationChannelManagerForUser sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 196608)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class PushNotificationChannelManagerForUser final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 196608)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class PushNotificationChannelManagerForUser final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 196608)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class PushNotificationChannelManagerForUser
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 196608)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class PushNotificationChannelManagerForUser
Public NotInheritable Class PushNotificationChannelManagerForUser
繼承
Object Platform::Object IInspectable PushNotificationChannelManagerForUser
屬性

Windows 需求

裝置系列
Windows 10 Anniversary Edition (已於 10.0.14393.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v3.0 引進)

範例

下列範例示範如何使用 CreatePushNotificationChannelForApplicationAsync 方法來擷取呼叫應用程式的推播通知通道。

var pushNotifications = Windows.Networking.PushNotifications;
var channel;

function openNotificationsChannel() {
    var channelOperation = pushNotifications.PushNotificationChannelManagerForUser.createPushNotificationChannelForApplicationAsync();
    return channelOperation.then(function (newChannel) {
        channel = newChannel;
    }
);

下列範例示範如何使用 CreatePushNotificationChannelForSecondaryTileAsync 方法來擷取次要磚的推播通知通道。

var pushNotifications = Windows.Networking.PushNotifications;
var channel;

pushNotifications.PushNotificationChannelManagerForUser.createPushNotificationChannelForSecondaryTileAsync(myTileId).then(function (channel) {
    // Your code here.
})

備註

這個類別沒有建構函式。 如需使用方式的詳細資訊,請參閱範例一節。

版本歷程記錄

Windows 版本 SDK 版本 新增值
1703 15063 CreateRawPushNotificationChannelWithAlternateKeyForApplicationAsync (IBuffer,String)
1703 15063 CreateRawPushNotificationChannelWithAlternateKeyForApplicationAsync (IBuffer,String,String)

屬性

User

取得使用者。

方法

CreatePushNotificationChannelForApplicationAsync()

建立物件,系結至呼叫的應用程式,您可以從 Windows 推播通知服務擷取推播通知通道, (WNS) 。

CreatePushNotificationChannelForApplicationAsync(String)

建立物件,系結至指定的應用程式,您可以從 Windows 推播通知服務擷取推播通知通道, (WNS) 。 指定的應用程式必須與呼叫的應用程式位於相同的套件中。

CreatePushNotificationChannelForSecondaryTileAsync(String)

建立物件,系結至 次要磚,您可以從 Windows 推播通知服務擷取推播通知通道, (WNS) 。 磚可以是呼叫端應用程式的次要磚,或是相同套件中的任何其他應用程式。

CreateRawPushNotificationChannelWithAlternateKeyForApplicationAsync(IBuffer, String)

建立系結至指定應用程式的物件,以便從 Windows 推播通知服務擷取推播通知通道, (WNS) 。 指定的應用程式必須與呼叫的應用程式位於相同的套件中。

CreateRawPushNotificationChannelWithAlternateKeyForApplicationAsync(IBuffer, String, String)

建立系結至指定應用程式的物件,以便從 Windows 推播通知服務擷取推播通知通道, (WNS) 。 指定的應用程式必須與呼叫的應用程式位於相同的套件中。

適用於