How I can prevent background task from running if there are foreground app being executed? Using Universal Windows Platform for my app.
My background task is checking for new items on some site and sends a toast when there are new things available, but I wan't to prevent toast sending if user is running application right now.
I have tried to unregister task on my application launch and register it again when app is terminated, through, this is not fine solution for me -- when device shuts down for some reason (for example, battery was removed) my task will be not registered until app launched again.
Thanks.
Use a named Mutex to synchronize between the foreground app and the background agent
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With