PushNotificationChannelManager Classe

Définition

Crée des objets que vous utilisez pour récupérer des canaux de notification Push à partir de Windows Push Notification Services (WNS). Ces canaux sont liés à une application ou à une vignette secondaire.

public ref class PushNotificationChannelManager abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class PushNotificationChannelManager final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class PushNotificationChannelManager final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
public static class PushNotificationChannelManager
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public static class PushNotificationChannelManager
Public Class PushNotificationChannelManager
Héritage
Object Platform::Object IInspectable PushNotificationChannelManager
Attributs

Configuration requise pour Windows

Famille d’appareils
Windows 10 (introduit dans 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduit dans v1.0)
Fonctionnalités de l’application
internetClient

Exemples

L’exemple suivant montre l’utilisation de la méthode CreatePushNotificationChannelForApplicationAsync pour récupérer un canal de notification Push pour l’application appelante.

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

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

L’exemple suivant illustre l’utilisation de la méthode CreatePushNotificationChannelForSecondaryTileAsync pour récupérer un canal de notification Push pour une vignette secondaire.

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

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

Remarques

Historique des versions

Version de Windows Version du SDK Valeur ajoutée
1607 14393 GetForUser
1703 15063 GetDefault
2004 19041 ChannelsRevoked

Méthodes

CreatePushNotificationChannelForApplicationAsync()

Crée un objet, lié à l’application appelante, via lequel vous récupérez un canal de notification Push à partir de Windows Push Notification Services (WNS).

CreatePushNotificationChannelForApplicationAsync(String)

Crée un objet, lié à une application spécifiée, par le biais duquel vous récupérez un canal de notification Push à partir de Windows Push Notification Services (WNS). L’application spécifiée doit se trouver dans le même package que l’application appelante. Cette surcharge ne doit être appelée qu’à partir d’un package multi-application. La plupart des applications doivent utiliser la méthode sans paramètre.

CreatePushNotificationChannelForSecondaryTileAsync(String)

Crée un objet, lié à une vignette secondaire, via lequel vous récupérez un canal de notification Push à partir de Windows Push Notification Services (WNS). La vignette peut être une vignette secondaire de l’application appelante ou de toute autre application dans le même package.

GetDefault()

Obtient le gestionnaire de l’utilisateur actif.

GetForUser(User)

Obtient les notifications Push pour l’utilisateur spécifié.

Événements

ChannelsRevoked

Déclenché lorsque votre canal Push est révoqué, afin que vous puissiez demander immédiatement un nouveau canal. Cela réduit les temps d’arrêt résultant de l’utilisation d’un canal WNS révoqué. Le type d’arguments d’événement est PushNotificationChannelsRevokedEventArgs.

S’applique à

Voir aussi