Reputation: 1076
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
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