If you register an in-process background task with a time trigger, every time span the background task triggered it will invoke the OnBackgroundActivated
event. So you may define the popup code inside this event. No matter your app is minimized or active the in-process background task will be triggered. For example:
Register:
public MainPage()
{
this.InitializeComponent();
var builder = new BackgroundTaskBuilder();
builder.Name = "My Background Trigger";
builder.SetTrigger(new TimeTrigger(15, true));
BackgroundTaskRegistration task = builder.Register();
}
Override OnBackgroundActivated
event and show a simple popup.
protected async override void OnBackgroundActivated(BackgroundActivatedEventArgs args)
{
base.OnBackgroundActivated(args);
await new Windows.UI.Popups.MessageDialog("test").ShowAsync();
//DoBackgroundWork(args.TaskInstance);
}