4

以下是 WP8 推送通知的代码。

HttpNotificationChannel pushChannel = new HttpNotificationChannel(channelName);

                // Register for all the events before attempting to open the channel.
                pushChannel.ChannelUriUpdated += new EventHandler<NotificationChannelUriEventArgs>(PushChannel_ChannelUriUpdated);
                pushChannel.ErrorOccurred += new EventHandler<NotificationChannelErrorEventArgs>(PushChannel_ErrorOccurred);

                // Register for this notification only if you need to receive the notifications while your application is running.
                pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(PushChannel_ShellToastNotificationReceived);

                pushChannel.Open();

                // Bind this new channel for toast events.
                pushChannel.BindToShellToast();
                pushChannel.BindToShellTile();

正如您在上面的代码中看到的,我将 pushChannel 绑定到shellToast 以及 shellTile。我想知道它是否有效?因为我在 msdn 上没有关于此的任何文档。如果可能并且服务器发送任何通知,它会正确显示吗? 请就此提出宝贵意见。

4

1 回答 1

4

这是可能的,而且是正确的方法。一个应用,一个频道,无论你使用多少种推送通知。

于 2013-07-24T09:00:11.540 回答