Proper update service, no sound on normal app start

This commit is contained in:
2021-11-17 22:17:54 +01:00
parent ccf871ce8b
commit 498e3dcbf5
6 changed files with 207 additions and 150 deletions

View File

@ -45,11 +45,11 @@ public class PortUpdatePlugin implements FlutterPlugin, StreamHandler {
batteryReceiver = createBatteryReceiver(eventSink);
headphoneReceiver = createHeadphoneReceiver(eventSink);
context.registerReceiver(batteryReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
context.registerReceiver(headphoneReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG));
Intent batteryIntent = context.registerReceiver(batteryReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
Intent headphoneIntent = context.registerReceiver(headphoneReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG));
// lastBatteryStatus = getBatteryStatus(intent);
// lastHeadphoneStatus = getHeadphoneStatus(intent);
if (batteryIntent != null) lastBatteryStatus = getBatteryStatus(batteryIntent);
if (headphoneIntent != null) lastHeadphoneStatus = getHeadphoneStatus(headphoneIntent);
}
@Override