Question

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

Était-ce utile?

La solution

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 :)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top