Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 822
tavier Avatar asked Oct 31 '22 08:10

tavier


1 Answers

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.

like image 157
tavier Avatar answered Nov 09 '22 07:11

tavier