user2782709
user2782709

Reputation: 17

How to force BackgroundWorker to continue running when app is closed?

I don't know how much about BackgroundWorker, and I have a problem. My BackgroundWorker is correctly running to completion when my app is open, but if my app is closed the BackgroundWorker does not complete.

Is there any way to force a BackgroundWorker to continue running when my app is closed, rather than the BackgroundWorker terminating?

Upvotes: 0

Views: 210

Answers (2)

Kevin Gosse
Kevin Gosse

Reputation: 39027

Any task launched by your application will stop executing when your app is closed, and there's nothing you can do against that (well, there's a few very specific exceptions, like geolocation apps).

If you need to run code while your app is closed, you need to use a background agent. Note that those agents have a few limitations, especially in memory usage, and can run only for a few seconds every 30 minutes.

Upvotes: 2

Related Questions