Cannot register a background task

0

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: https://www.dropbox.com/sh/1v9mbr3xhgr3283/AACDbB7skZUI7Z5fiu0HT8r4a?dl=0

c#
uwp
windows-10-mobile
background-task
asked on Stack Overflow Nov 13, 2016 by Moisej Braver

1 Answer

1

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.

answered on Stack Overflow Nov 13, 2016 by ibebbs

User contributions licensed under CC BY-SA 3.0