Element not found (Exception from HRESULT: 0x80070490) while calling BackgroundExecutionManager.RequestAccessAsync()

5

While trying to get the lockscreenaccessstatus by calling BackgroundExecutionManager.RequestAccessAsync()on the very first launch of my WinRT app, I am getting this exception:

(Exception from HRESULT: 0x80070490)

Weirdly, this issue is no more happening on the second (and subsequent) launch of the app.

I read that as a workaround we can introduce a Task.Delay(1000) just before calling the BackgroundExecutionManager.RequestAccessAsync(). But, it does not seem to be working for me. Any ideas?

c#
background
windows-runtime
windows-8.1
asked on Stack Overflow Mar 20, 2015 by tavier • edited Mar 22, 2018 by abatishchev

1 Answer

2

So, I finally was able to figure out the workaround. I moved the code to prompt the user BackgroundExecutionManager.RequestAccessAsync() to a later stage, i.e. when I have loaded my first VM. It all works fine now.

answered on Stack Overflow Mar 24, 2015 by tavier

User contributions licensed under CC BY-SA 3.0