static void StopBatteryListeners() { try { Platform.AppContext.UnregisterReceiver(batteryReceiver); } catch (Java.Lang.IllegalArgumentException) { System.Diagnostics.Debug.WriteLine("Battery receiver already unregistered. Disposing of it."); } batteryReceiver.Dispose(); batteryReceiver = null; }
static void StopBatteryListeners() { Platform.CurrentContext.UnregisterReceiver(batteryReceiver); batteryReceiver?.Dispose(); batteryReceiver = null; }