예제 #1
0
 static void StopBatteryListeners()
 {
     Platform.CurrentContext.UnregisterReceiver(batteryReceiver);
     batteryReceiver?.Dispose();
     batteryReceiver = null;
 }
예제 #2
0
 static void StartBatteryListeners()
 {
     ValidateBatteryStatsPermission();
     batteryReceiver = new BatteryBroadcastReceiver(OnBatteryChanged);
     Platform.CurrentContext.RegisterReceiver(batteryReceiver, new IntentFilter(Intent.ActionBatteryChanged));
 }