From 5e15040c561b9da10f15eb0d7d33a91f2bbebc69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 12 Jul 2024 09:42:24 +0900 Subject: [PATCH] =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/example/childguard/TestService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/example/childguard/TestService.java b/app/src/main/java/com/example/childguard/TestService.java index f897d29..e8091c5 100644 --- a/app/src/main/java/com/example/childguard/TestService.java +++ b/app/src/main/java/com/example/childguard/TestService.java @@ -315,10 +315,15 @@ public class TestService extends Service { Log.d("BT_Judge", "Not registered device"); return; } - // ----------------------------------------------------- String action = intent.getAction(); // may need to chain this to a recognizing function boolean isInCar = getSharedPreferences("Bluetooth_situation", MODE_PRIVATE).getBoolean("isInCarPref", false); - if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action) && isInCar) { + if (!isInCar) { + Log.d("BT_Judge", "Not in car"); + return; + } + // ----------------------------------------------------- + + if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) { // bluetoothが切断されたときに乗車状態のとき notificationRunnable = () -> { // 5分経過した時点でも車に乗っていない場合