Q:

bring uwp app in foreground

I found posts about how to detect if the app runs in foreground. Is it possible to bring my UWP app to the foreground (when it runs in the background) somehow? Maybe it's possible with a background task?

A:

This is how I got it to work for UWP running on Windows 10:

In your manifest create a protocol declaration (insert Name and Display name meaningful to your app)
In App settings for the protocol change the Desired view to Use Half
Use the Launcher to call your registered protocol whenever your app should come to the foreground

In the example below replace yourprotocolhere with the protocol you registered for your app. 
await Windows.System.Launcher.LaunchUriAsync(new Uri("yourprotocolhere://"));

