Start backup when power comes down to certain %

  • Thread starter Thread starter Pankaj S.
  • Start date Start date
P

Pankaj S.

Hi,

How can I take a backup of my application when power comes down to say X %.
I want to schedule this task through program?

Thanks in Advance.
Pankaj
 
There is no event exposed when power level reaches a specified percentage,
therefore the only alternative is to check on a regular basis the power
status and begin your backup procedure if it is below your threshold.
Polling for this information will be bad for battery life itself so you
should not call this too frequently. If you want this check to take place
while your app is running you can start a background thread which checks the
power status and then sleeps for a while in a loop. If you want to be able
to check this state even when your app isn't running you could use
RunAppAtTime to run a small application at timed intervals to check the
current status.

Peter
 
Back
Top