WP8推送通知通道名称

时间:2014-03-08 14:58:38

标签: c# windows-phone-8

我在页面加载事件中使用以下代码并在通道名称上获取异常。

HttpNotificationChannel pushChannel;

// The name of our push channel.
string channelName = "ToastSampleChannel";
pushChannel = HttpNotificationChannel.Find(channelName);

An exception of type 'System.UnauthorizedAccessException' occurred in Microsoft.Phone.ni.dll but was not handled in user code

1 个答案:

答案 0 :(得分:0)

在WMAppManifest中,您需要添加ID_CAP_PUSH_NOTIFICATION功能。

<Capabilities>
      ......
      <Capability Name="ID_CAP_PUSH_NOTIFICATION" />
</Capabilities>