我正在开发一个WP-8.1 Silverlight应用程序,并试图通过azure通知中心注册我的应用程序,但我正在注册MPNS,而不是在构建时代码中没有错误,并已将WMappmanifest中的通知服务更改为WNS也已在通知中心中更新凭据当我在通知中心中看到我的注册时,它显示MPNS而不是WNS
var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
var hub = new NotificationHub(AzureNotificationHubName,AzureNotificationHubCnxString);
var result = await hub.RegisterNativeAsync(channel.Uri);
// Displays the registration ID so you know it was successful
if (result.RegistrationId != null)
{
PushChannel = channel;
PushChannel.PushNotificationReceived += OnPushNotification;
}发布于 2017-02-09 14:33:31
如果你仔细阅读"Sending push notifications with Azure Notification Hubs on Windows Phone",你会注意到第二个注意事项:
通知中心Windows Phone SDK不支持将Windows推送通知服务(WNS)与Windows Phone 8.1 Silverlight应用程序一起使用。要在Windows Phone 8.1 Silverlight应用程序中使用WNS (而不是MPNS),请按照使用REST API的通知中心- Windows Phone Silverlight教程进行操作。
此链接指向如何为WP Silverlight应用程序启用WNS注册的分步指南。您需要编写自己的代码通过REST API进行注册。
这就是指南:https://github.com/Azure/azure-notificationhubs-samples/tree/master/PushToSLPhoneApp
我犯了同样的错误-没有读第二个笔记,浪费了几天的时间试图让注册正确。
https://stackoverflow.com/questions/32533967
复制相似问题