locked
Auto restart windows mobile when battery life gets approximately 10% RRS feed

  • Question

  • Windows mobile will switching the mobile off on the device when the battery life gets to approximately 10%, so the user does not have to switch the phone back on once the battery life raise above 10%. It should be automatically. Can anyone help me on this:-

    How to achieve this [using programatically [.net] or any other way] please provide sample code or reference.

     

    Thanks,

    Mobility

     

    Monday, June 13, 2011 7:41 AM

Answers

  • Sure, Joel posted an article using CeSetUserNotification to Code Project: http://www.codeproject.com/Articles/55430/Using-CeSetUserNotification-to-start-a-program.aspx

    It will wake the device at a given time and execute an application.

    -PaulH

    • Marked as answer by Jesse Jiang Tuesday, June 28, 2011 8:26 AM
    Wednesday, June 22, 2011 1:30 PM

All replies

  • Use the RequestPowerNotifications to be alerted of changes to the battery life. When the battery says it's below your threshold (10%), issue a SetSystemPowerState( L"Suspend", 0, 0 ); to suspend the device.

    In C#, you will need to P/Invoke these APIs they're not available in the BCL.

    -PaulH

    • Proposed as answer by Jesse Jiang Wednesday, June 15, 2011 8:41 AM
    Monday, June 13, 2011 8:31 PM
  • Once the device switched off, can we execute code of C#.

    Thursday, June 16, 2011 6:13 AM
  • Once the device switched off, can we execute code of C#.


    Of course not.

    You can, however, use CESetUserNotification to wake the device and notify your application when the device is put on charge.

    -PaulH

    Thursday, June 16, 2011 1:30 PM
  • Can you please provide any sample code to wake the device from sleep state.

    Thanks in advance.

    Tuesday, June 21, 2011 6:45 AM
  • Sure, Joel posted an article using CeSetUserNotification to Code Project: http://www.codeproject.com/Articles/55430/Using-CeSetUserNotification-to-start-a-program.aspx

    It will wake the device at a given time and execute an application.

    -PaulH

    • Marked as answer by Jesse Jiang Tuesday, June 28, 2011 8:26 AM
    Wednesday, June 22, 2011 1:30 PM