domenica 2 dicembre 2012

Windows Phone - Battery API

One of the new additions with the Windows Phone SDK 8.0, is the ability to query the battery charge.

Here the simple code:
Battery battery = Battery.GetDefault();
var percentage = battery.RemainingChargePercent;
var remainingTime = battery.RemainingDischargeTime;

And the event:
battery.RemainingChargePercentChanged += (s, args) =>
 // your code here


2 commenti:

  1. Questo commento è stato eliminato da un amministratore del blog.