From 3787b8f914e28035216fc4e4d0c0788d860f5692 Mon Sep 17 00:00:00 2001 From: Philoul Date: Wed, 15 Dec 2021 01:52:50 +0100 Subject: [PATCH] Fix Crash on Insight Driver --- .../insight/connection_service/InsightConnectionService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/connection_service/InsightConnectionService.java b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/connection_service/InsightConnectionService.java index fc5616b986..114dbdbe62 100644 --- a/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/connection_service/InsightConnectionService.java +++ b/insight/src/main/java/info/nightscout/androidaps/plugins/pump/insight/connection_service/InsightConnectionService.java @@ -108,8 +108,7 @@ public class InsightConnectionService extends DaggerService implements Connectio private DelayedActionThread disconnectTimer; private DelayedActionThread recoveryTimer; private DelayedActionThread timeoutTimer; - private final BluetoothAdapter bluetoothAdapter = - ((BluetoothManager)getApplicationContext().getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter(); + private BluetoothAdapter bluetoothAdapter; private BluetoothDevice bluetoothDevice; private BluetoothSocket bluetoothSocket; private ConnectionEstablisher connectionEstablisher; @@ -259,6 +258,7 @@ public class InsightConnectionService extends DaggerService implements Connectio @Override public synchronized void onCreate() { super.onCreate(); + bluetoothAdapter = ((BluetoothManager)getApplicationContext().getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter(); pairingDataStorage = new PairingDataStorage(this); state = pairingDataStorage.isPaired() ? InsightState.DISCONNECTED : InsightState.NOT_PAIRED; wakeLock = ((PowerManager) getSystemService(POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "AndroidAPS:InsightConnectionService");