user738471
user738471

Reputation: 909

Detect UWP app launch from UWP background task

Is it possible to register for UWP app launch events from UWP background task? For example, once the UWP calc app is opened, my background task need to be notified on that.

Upvotes: 1

Views: 217

Answers (3)

Trozanx83_11
Trozanx83_11

Reputation: 11

You can register and trigger a background task of trigger type Application trigger when App launches in the OnLaunched method.

Upvotes: 0

Adam Dernis
Adam Dernis

Reputation: 530

You're going to want to use in-process background tasks. These basically make it so the app basically goes in a lightweight mode when you exit the app and when you open it the app can handle all the processes with it.

Upvotes: 0

Marian Dolinský
Marian Dolinský

Reputation: 3492

Technically, it is possible.

Since Fall Creators Update (16299) there's new UWP App Diagnostics API through which you could enumerate all currently running processes. Not sure about registering for launch events, but if you periodically (for example every 5 seconds) enumerate running processes, you could get what you want.

Take a look at this blogpost, this related GitHub sample and official documentation.

Upvotes: 1

Related Questions