Moisej Braver Moisej Braver - 3 months ago 39
C# Question

Cannot register a background task

I am writing an app that continuously scans for all access points that are in range and saves log to a text file. The scanning should start when user clicks the "Start" button and run until "Stop" button is clicked even if user switched to other app.

As I understand, this functionality can be achieved using the background task but I keep getting exception telling "Not enough quota is available to process this command. (Exception from HRESULT: 0x80070718)", when trying to register a background task.

Any ideas, what might be wrong?

Full code:


Are you registering the background task every time your app runs? Are you checking to see if it is already registered? It's possible to register your background task multiple times and, as only so many background tasks registrations are allowed (depending on device) then you may have run out of capacity. Check this page which provides the following quote:

It's important to check this because if a task is registered multiple times, it will run more than once whenever it’s triggered; this can use excess CPU and may cause unexpected behavior.