windows-phone-8.1windows-phone-silverlight

WP8.1 silverlight - Notification activated event not being called


I am working on a Windows Phone 8.1 silverlight app, raw notifications handling.

The App when receives notifications in foreground, has to cancel the notification and create a new notification using ToastNotificationManager.CreateToastNotifier().

It also has a backgroundtask to work on the raw notifications received in background, which converts the raw notifications received to toast notification using ToastNotificationManager.CreateToastNotifier().

Also some action A needs to be performed on clicking of this notification.

The issue arises when the App receives the notification when in foreground, but the notification is clicked after suspending the application. Since the registered activated event of such type of notification is not in the background task (because the notification was formed in the foreground logic), no action A is performed on clicking of the notification.

This seems to a limitation, for WP8.1 silverlight apps. Can somebody suggest a solution for this issue??


Solution

  • If you need to do some action after tap on Toast you should add wp:Param to your Toast with deep url and handle in you app. Toast will be look like

    <wp:Notification xmlns:wp=\"WPNotification\">
        <wp:Toast>
            <wp:Text1>You title</wp:Text1>
            <wp:Text2>Your subtitle</wp:Text2>" +
            <!-- You can add any parameter you want in deep url -->
            <wp:Param>/Page2.xaml?NavigatedFrom=Toast Notification</wp:Param>
        </wp:Toast>
    </wp:Notification>
    

    When you tap on toast it by default will open Page2.xaml of your app and pass uri parameters to it