Partager via


Running a scheduled app in unattended mode

This question came up in a webcast:

"I have an app that wakes up the device periodically.  I don't want to waste battery power, so when my app is done doing its thing, I don't want to wait for the normal three minute timeout.  I'd like the device to go to sleep right away if it can.  How do I do this?"

The answer is to put your app into "unattended mode".  You do this by calling PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE).  Then when your app is done doing what it needs to do, call PowerPolicyNotify(PPN_UNATTENDEDMODE, FALSE). 

Note:

This is a reference-counted API, so be careful to pair up each TRUE call with exactly one FALSE call.

The screen will not turn on while you are in unattended mode, which is usually what you want.

PowerPolicyNotify() is defined in pmpolicy.h

Comments

  • Anonymous
    November 29, 2004
    I have almost the same question. I have been using Pocket PC for 3yrs. I had a Ipaq 3955 then upgrade to a Ipaq 3715. But my problem is every day I need to do a soft reset and I don't know why. Please help.

  • Anonymous
    November 30, 2004
    handy-tastic!

    PS I notice that my power usage goes through the roof when i set myself up to get a periodic wakeup from CeRunAppAtTime(), is this MS implemented or done by the OEM? is there a more efficient way of getting a notification without draining the battery?

    riki

  • Anonymous
    February 03, 2007
    "I have an app that runs in an unnatended mode. In case batteries goes off, how could I start up the app when power comes in without human intervention?

  • Anonymous
    February 05, 2007
    Carlos, are you talking about what to do when the batteries die or someone pulls them out of the phone?  When the device gets power again, it will boot up.  You have a few options for getting your app to launch on bootup, depending on what kind of app it is and whether you're an ISV or an OEM.   The easiest solution, probably, is to put a shortcut to your application is WindowsStartUp After the system boots, everything in that folder is run. Mike

  • Anonymous
    March 26, 2007
    On personal opinion, I find this very helpful. Guys, I have also posted some more relevant info further on this, not sure if you find it useful: http://www.bidmaxhost.com/forum/