Exemplo n.º 1
0
        public BatteryInfo GetBatteryInfo(long freshness)
        {
            if (this.lastBatteryInfo != null && this.lastBatteryCheckTime > (DateTime.Now.AddMilliseconds(-freshness)))
            {
                return(this.lastBatteryInfo);
            }
            BatteryReceiver receiver = new BatteryReceiver();

            ExecuteShellCommand("dumpsys battery", receiver, BATTERY_TIMEOUT);
            this.lastBatteryInfo      = receiver.BatteryInfo;
            this.lastBatteryCheckTime = DateTime.Now;
            return(this.lastBatteryInfo);
        }
Exemplo n.º 2
0
 public BatteryInfo GetBatteryInfo(long freshness)
 {
     if (this.lastBatteryInfo != null && this.lastBatteryCheckTime > (DateTime.Now.AddMilliseconds(-freshness)))
         {
         return this.lastBatteryInfo;
         }
     BatteryReceiver receiver = new BatteryReceiver();
     ExecuteShellCommand("dumpsys battery", receiver, BATTERY_TIMEOUT);
     this.lastBatteryInfo = receiver.BatteryInfo;
     this.lastBatteryCheckTime = DateTime.Now;
     return this.lastBatteryInfo;
 }