locked
Stop Phone From Powering Down RRS feed

  • Question

  • Hi, I have a phone app on Windows mobile 6 that allows the user to get his GPS lat and long and send them back to home base, but when the program is left alone for about 2 minutes the phone powers down (goes dark) and the GPS stops updating. And will not start updating again for around another 30 seconds, this could obviously cause for some inaccurate data.

    Anyway I can stop this from happening?
    Wednesday, November 25, 2009 4:18 AM

Answers

  • Do you just want the update to continue occurring when the screen turns off are do you want to prevent the screen from turning off.

    From http://www.codeproject.com/KB/mobile/WiMoPower1.aspx

    Preventing the System from Powering Down

    Pocket PCs will automatically progress towards their suspended states if no user actions are detected. There are times at which you may need for a device to maintain its full power state even though the user isn't directly interacting with the system (such as when listening to music with Windows Media Player). To prevent the system from powering down from being idle periodically, make calls to SystemIdleTimerReset(). Calling this function prevents the suspend timeout from being reached. The suspend timeouts can be changed on a system, so you will need to query for the suspend values and ensure that you call SystemIdleTimerReset on an interval shorter than the smallest suspend timeout value.

    There's also a code sample that will get the device ( and your program) active after the screen turns off.  A consequence of this is the power will continue to drain from your battery.  In the sample the following is called to ensure the program doesn't stop running.

    CoreDLL.PowerPolicyNotify(PPNMessage.PPN_UNATTENDEDMODE, -1);


    When the program is done working it can release it's request to keep the device active with the following call:
    CoreDLL.PowerPolicyNotify(PPNMessage.PPN_UNATTENDEDMODE, 0);


    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.
    • Proposed as answer by Michael Koster Wednesday, November 25, 2009 5:42 PM
    • Marked as answer by Bonzol Thursday, November 26, 2009 12:11 AM
    Wednesday, November 25, 2009 3:57 PM
    • Marked as answer by Bonzol Thursday, November 26, 2009 12:11 AM
    Wednesday, November 25, 2009 6:23 AM

All replies

    • Marked as answer by Bonzol Thursday, November 26, 2009 12:11 AM
    Wednesday, November 25, 2009 6:23 AM
  • Do you just want the update to continue occurring when the screen turns off are do you want to prevent the screen from turning off.

    From http://www.codeproject.com/KB/mobile/WiMoPower1.aspx

    Preventing the System from Powering Down

    Pocket PCs will automatically progress towards their suspended states if no user actions are detected. There are times at which you may need for a device to maintain its full power state even though the user isn't directly interacting with the system (such as when listening to music with Windows Media Player). To prevent the system from powering down from being idle periodically, make calls to SystemIdleTimerReset(). Calling this function prevents the suspend timeout from being reached. The suspend timeouts can be changed on a system, so you will need to query for the suspend values and ensure that you call SystemIdleTimerReset on an interval shorter than the smallest suspend timeout value.

    There's also a code sample that will get the device ( and your program) active after the screen turns off.  A consequence of this is the power will continue to drain from your battery.  In the sample the following is called to ensure the program doesn't stop running.

    CoreDLL.PowerPolicyNotify(PPNMessage.PPN_UNATTENDEDMODE, -1);


    When the program is done working it can release it's request to keep the device active with the following call:
    CoreDLL.PowerPolicyNotify(PPNMessage.PPN_UNATTENDEDMODE, 0);


    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.
    • Proposed as answer by Michael Koster Wednesday, November 25, 2009 5:42 PM
    • Marked as answer by Bonzol Thursday, November 26, 2009 12:11 AM
    Wednesday, November 25, 2009 3:57 PM