locked
Power events in a Windows Store app

    Question

  • Hi all,

    I'm looking to find a way for my app to get notified when the computer wakes from hibernation.  I've got a background task that runs every 15 minutes keeping a live tile up-to-date.  I also have a notification for when a user logs in...so the tile doesn't stay blank until the 15 minute timer kicks off...

    However, upon wake up after the computer hibernates, the tiles are blank for too long (at least to long for me...).

    I've seen lots of stuff about catching power events and the fact that Windows Store apps should use the OnSuspending event - which I'm doing :) - but nothing about catching the other edge...ie waking up.

    Is there a way, or is there something better for a Windows Store App?

    Thanks,

    Brian

    Monday, December 22, 2014 3:07 AM

Answers

  • If you're already using a SystemTrigger to detect when the user is present again, there's not much more that your app can do.  Any further kind of detection would involve non-WinRT programming.

    Exactly how long is it waiting?  You may want to do some logging to see if the problem is in the length of time it takes for the background task to get activated (such as log the time that it starts processing) so you can pinpoint the issue.  If it seems excessive, let us know.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by EricksonBrian Monday, December 22, 2014 8:32 PM
    Monday, December 22, 2014 1:29 PM
    Moderator

All replies

  • If you're already using a SystemTrigger to detect when the user is present again, there's not much more that your app can do.  Any further kind of detection would involve non-WinRT programming.

    Exactly how long is it waiting?  You may want to do some logging to see if the problem is in the length of time it takes for the background task to get activated (such as log the time that it starts processing) so you can pinpoint the issue.  If it seems excessive, let us know.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by EricksonBrian Monday, December 22, 2014 8:32 PM
    Monday, December 22, 2014 1:29 PM
    Moderator
  • Well actually I was using SessionConnected system trigger...replaced it with UserPresent and it handles all cases (actually logging in, waking from sleep and waking from hibernation).  Should have thought of that myself...thanks for the help.

    Brian

    Monday, December 22, 2014 8:32 PM