v.g.
v.g.

Reputation: 1076

Receive and handle a notification arguments when the Windows (phone) 8.1 app is on foreground

When I receive a notification and top on the badge or from the notification center the app opens with OnLaunched(LaunchActivatedEventArgs e) in the App.xaml.cs file. I take the arguments from e.Arguments and do whatever I want to do with it.

Is there a way to get those arguments when I receive a notification and I am in the app (on foreground)?

Upvotes: 0

Views: 443

Answers (1)

Andrii Krupka
Andrii Krupka

Reputation: 4306

Try this solution:

PushNotificationChannel currentChannel = myChannel;
currentChannel.PushNotificationReceived += OnPushNotificationReceived;

void OnPushNotificationReceived(PushNotificationChannel sender, PushNotificationReceivedEventArgs e)
{  
    e.Cancel = true; // True to prevent default processing of the notification by Windows
    // implement your logic there
}

Upvotes: 1

Related Questions