Toast notification, when app is not running

淺唱寂寞╮ 提交于 2019-12-08 01:10:58

问题


I write app on Windows Phone 8 with service of push notification (only toast), I have yet MSSQL Job which send pushes to my mobile app. Send data have this below format (typeId is int, which tell what app should do with data):

<?xml version=\"1.0\" encoding=\"utf-8\"?>
<wp:Notification xmlns:wp=\"WPNotification\">
<wp:Toast>
<wp:Text1>title</wp:Text1>
<wp:Text2>subtitle</wp:Text2>
<wp:Data>typeId;data</wp:Data>
</wp:Toast>
</wp:Notification>

When push income when I have running app, I can service my app by method (this case works fine)

httpChannel.ShellToastNotificationReceived += 
    new EventHandler<NotificationEventArgs>(httpChannel_ShellToastNotificationReceived);

httpChannel.BindToShellToast();

My problem is unable to service toast push notification, when app is not running. Push income with texts from XML, but when I click notification I go into main page of my app. How can I attach my code to decide what to do by typeId and data from XML


回答1:


I find solution: XML should contains

<wp:Param></wp:Param>

section inside <wp:Toast> section. In rows I can put view adress with query string. After click notification bar I will redirect to this view. Parameters from query string will decide (in NavigateTo event) what program has to do :)



来源:https://stackoverflow.com/questions/15209535/toast-notification-when-app-is-not-running

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!