From 464e919e6446f6c3ea72a5976e5f976b31173655 Mon Sep 17 00:00:00 2001 From: "David G. Young" Date: Tue, 4 Jun 2019 14:24:51 -0400 Subject: [PATCH 1/2] Fix IllegalArgumentException from ending user switch watching --- .../altbeacon/beacon/service/scanner/CycledLeScanner.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/main/java/org/altbeacon/beacon/service/scanner/CycledLeScanner.java b/lib/src/main/java/org/altbeacon/beacon/service/scanner/CycledLeScanner.java index 399f10716..e9d5d28c1 100644 --- a/lib/src/main/java/org/altbeacon/beacon/service/scanner/CycledLeScanner.java +++ b/lib/src/main/java/org/altbeacon/beacon/service/scanner/CycledLeScanner.java @@ -513,7 +513,10 @@ public void onReceive(Context context, Intent intent) { } protected void cleanupCancelAlarmOnUserSwitch() { if (mCancelAlarmOnUserSwitchBroadcastReceiver != null) { - mContext.unregisterReceiver(mCancelAlarmOnUserSwitchBroadcastReceiver); + try { + mContext.unregisterReceiver(mCancelAlarmOnUserSwitchBroadcastReceiver); + } + catch (IllegalArgumentException e) {} // thrown if OS does not think it was registered mCancelAlarmOnUserSwitchBroadcastReceiver = null; } } From b1a46d552ff9323a7466a9d9f4c9994b6ba2685a Mon Sep 17 00:00:00 2001 From: "David G. Young" Date: Wed, 5 Jun 2019 13:26:07 -0400 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 707deabdf..6f6fedec9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### Development + +- Prevent crash from IAE when ending scan cycle (#891, David G. Young) + ### 2.16.2 / 2019-05-29 - Prevent crash on alarms going off with a different user active (#886, David G. Young)