I'm developping a Windows phone App and I cannot figure out how trigger a backgroundtask everytime the battery level changes. I mean, I would like to launch a task everytime the battery goes -1%. I've looked in SystemTrigger class but I found nothing about the battery state. Does somebody has an idea ?
You can get the current battery charge using something like this.
int charge = Windows.Phone.Devices.Power.Battery.GetDefault().RemainingChargePercent;
But I'm not sure that you will be capable of running a backgroundtask when the battery decreases. Your backgroundtask doesn't run continuously. The phones scheduler defines when the background tasks are run and once the code in your background task ends it can't do anything until the scheduler runs it again.