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) 检索推送通知通道。 指定的应用必须与调用应用位于同一个包中。

适用于