我希望在收到推送通知(来自azure的原始消息)时执行我自己的功能,即使应用程序没有运行 . 并且用户无需单击操作栏中的通知 .
我试过这种方式“Execute some function after raw push notifications is received from server in Window Phone 8.1”
但我没有得到背景事件,甚至azure成功发送原始消息,但吐司消息正在工作
我在MS开发仪表板上注册了我的appname,我试过windows phone silverlight 8.1和运行时...
请帮我提前谢谢.....
1 回答
经过长时间的研究,我能够从后台获得原始通知,这次我使用MS推送样本服务器(http://pushtestserver.azurewebsites.net/wns/),它需要URI,包安全标识符(SID)和客户端密钥 .
(通用应用程序)
var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
string uri = channel.Uri;
包安全标识符(SID)和客户端密钥可以从开发人员仪表板获取(您应该有开发者帐户来获取仪表板)
右键单击您的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'
Set Tost能够'是',并且锁定屏幕通知在Package.appxmanifest中是'徽章或徽章/ Tiletest'
(Windows phone 8.1 Silver light)
1和2与通用应用程序相同
4与通用应用程序相同
提示:原始通知样本表格Microsoft没有完全实现Windows手机,要为Windows手机工作请创建后台项目并添加对您的Windows手机项目的引用 .