diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java index a66528b49..ef0f388ef 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/DeviceCommunicationService.java @@ -814,6 +814,7 @@ public class DeviceCommunicationService extends Service implements SharedPrefere } if (mAutoConnectInvervalReceiver != null) { unregisterReceiver(mAutoConnectInvervalReceiver); + mAutoConnectIntervalReceiver.destroy(); mAutoConnectInvervalReceiver = null; } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/receivers/AutoConnectIntervalReceiver.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/receivers/AutoConnectIntervalReceiver.java index dad443888..b8540347c 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/receivers/AutoConnectIntervalReceiver.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/receivers/AutoConnectIntervalReceiver.java @@ -103,4 +103,8 @@ public class AutoConnectIntervalReceiver extends BroadcastReceiver { } } + public void destroy() { + LocalBroadcastManager.getInstance(service).unregisterReceiver(this); + } + }