If you're displaying your notification from a background task just add a flag to the local storage that indicates whether your app is open or not:
LocalSettings.Values.Add("IsAppOpen", true);
Now all you have to do is to set that flag to true or false whenever your app is:
- activated / launched
- suspended
- resumed
You can use the standard handlers:
Application.Current.Resuming += new EventHandler<Object>(App_Resuming);
Application.Current.Suspending += new SuspendingEventHandler(App_Suspending);
OnLaunched / OnActivated should already be implemented in your App.xaml.cs. In all those handlers set your flag to the corresponding value:
LocalSettings.Values["IsAppOpen"] = true; // Or false, when the app is suspended
You can read the flag from your background process and stop displaying notifications.