在 Window Phone 8.1 中从服务器收到后台原始推送通知

Background raw push notifications is received from server in Window Phone 8.1

我想在收到推送通知(来自 Azure 的原始消息)时执行我自己的功能,即使应用程序不是 运行。并且用户不需要点击操作栏中的通知。

我试过这种方式“Execute some function after raw push notifications is received from server in Window Phone 8.1

但我没有收到后台事件,即使 azure 也成功发送了原始消息,但 toast 消息正在运行

我在 MS 开发仪表板上注册了我的应用程序名称,我也尝试了 windows phone silverlight 8.1 和运行时...

请帮助我提前谢谢.....

经过长时间的研究,我可以从后台获取原始通知,这次我使用的是 MS 推送示例服务器 (http://pushtestserver.azurewebsites.net/wns/),它需要 URI、包安全标识符 (SID) 和客户端密码。

(通用应用程序)

  1. 您可以从应用程序中获取 URI

var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();

字符串 uri = channel.Uri;

  1. Package Security Identifier (SID) 和 Client Secret 可以从 developer dashboard 获取(你应该有 developer account 才能获取 dashboard)

  2. 右键单击您的 WPproject 'store->Associate App with the Store...' 按照说明操作... (https://azure.microsoft.com/en-in/documentation/articles/notification-hubs-windows-store-dotnet-get-started-wns-push-notification/) 检查 'Register your app for the Windows Store'

  3. 在 Package.appxmanifest

  4. 中设置支持 'yes' 和锁屏通知 'badge or badge/Tiletest'

(Windows phone 8.1银光)

1 和 2 与通用应用相同

  1. 'store->Associate App with the Store...' 不适用于 silverlight 项目关联应用程序填写您的包裹详细信息与您的仪表板注册的应用程序详细信息(尝试将您的 xap 文件上传到商店会给您与帐户不匹配的地方)

4 与通用应用相同

提示:Microsoft 未针对 windows phone 完全实现原始通知示例表单,要为 windows phone 工作,请创建后台项目并添加对您的引用windows phone 项目。