Windows phone 7 处理Toast和原始推送通知

Windows phone 7 处理Toast和原始推送通知,windows-phone-7,push-notification,mpns,Windows Phone 7,Push Notification,Mpns,我的WP7应用程序需要处理不同类型的推送通知。其中一些仅在应用程序运行时相关,但有一种类型用于提示用户启动应用程序,以及在应用程序运行时需要处理。因此,当打开推送通道时,我的代码调用BindToSellToast,并在收到原始和toast通知时注册事件处理程序: if (!_pushChannel.IsShellToastBound) { _pushChannel.BindToShellToast(); } _pushChannel.HttpNotificationReceived +

我的WP7应用程序需要处理不同类型的推送通知。其中一些仅在应用程序运行时相关,但有一种类型用于提示用户启动应用程序,以及在应用程序运行时需要处理。因此,当打开推送通道时,我的代码调用BindToSellToast,并在收到原始和toast通知时注册事件处理程序:

if (!_pushChannel.IsShellToastBound)
{
    _pushChannel.BindToShellToast();
}

_pushChannel.HttpNotificationReceived += new EventHandler<HttpNotificationEventArgs>(pushChannel_HttpNotificationReceived);
_pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(pushChannel_ShellToastNotificationReceived);
if(!\u pushChannel.ishelltoastbunded)
{
_pushChannel.BindToShellToast();
}
_pushChannel.HttpNotificationReceived+=新事件处理程序(pushChannel\u HttpNotificationReceived);
_pushChannel.ShellToastNotificationReceived+=新事件处理程序(pushChannel\u ShellToastNotificationReceived);
看看认证要求,似乎我必须提供一个用户设置,以允许他们不仅启用/禁用一般的推送通知,而且还特别启用/禁用toast通知。见(要求6.2.1)


由于用户可能会启用常规推送通知,但禁用toast通知,因此在我看来,我的服务器可能需要为应用程序未运行时需要处理的类型发送原始和toast通知。这将使注册ShellToastNotificationReceived事件变得毫无意义。我的想法正确吗?

您应该在服务器上为每个注册设备存储一个设置,命名用户允许的通知类型。

谢谢您的建议。不幸的是,这对我来说不是一个容易的选择,但我可以看到它会解决我的问题,所以我把它标记为答案。