From 751d47aee7417452ce9a13507a9e82c329f3493c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Mon, 29 Jul 2024 17:54:37 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=AD=E3=83=BC=E4=BF=AE=E6=AD=A3,=20?= =?UTF-8?q?=E5=90=A6=E5=AE=9A=E8=BF=BD=E5=8A=A0,=20=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/example/childguard/TestService.java | 11 +++++++++-- 1 file changed, 9 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 996e8ed..1b3244e 100644 --- a/app/src/main/java/com/example/childguard/TestService.java +++ b/app/src/main/java/com/example/childguard/TestService.java @@ -27,6 +27,8 @@ import androidx.core.app.NotificationManagerCompat; import com.google.firebase.firestore.DocumentReference; import com.google.firebase.firestore.FirebaseFirestore; +import org.checkerframework.checker.index.qual.LengthOf; + public class TestService extends Service { private final Handler handler = new Handler(); @@ -73,7 +75,7 @@ public class TestService extends Service { private static final NotificationContent REPORTED_NOTIFICATION = new NotificationContent("子供の置き去りをしていませんか?", "第三者からの通報が行われました。", REPORTED_CHANNEL_ID, 2); private static final NotificationContent BLUETOOTH_NOTIFICATION = - new NotificationContent("子供の置き去りをしていませんか?", "Bluetoothと車の切断から5分が経過しました", BT_ALERT_CHANNEL_ID, 3); + new NotificationContent("子供の置き去りをしていませんか?🐈", "Bluetoothと車の切断から5分が経過しました", BT_ALERT_CHANNEL_ID, 3); private String userId = null; @@ -315,13 +317,18 @@ public class TestService extends Service { Log.d("BT_Judge", "Not registered device"); return; } - boolean isInCar = getSharedPreferences("Bluetooth_situation", MODE_PRIVATE).getBoolean("isInCarPref", false); + boolean isInCar = !getSharedPreferences("app_situation", MODE_PRIVATE).getBoolean("change", false); if (!isInCar) { Log.d("BT_Judge", "Not in car"); return; } // ----------------------------------------------------- + // debug log + Log.d("BT", "Bluetooth device found: " + deviceHardwareAddress); + Log.d("BT", "Registered device: " + registeredId); + Log.d("BT", "Is in car: " + isInCar); + String action = intent.getAction(); // may need to chain this to a recognizing function if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) { // bluetoothが切断されたときに乗車状態のとき -- 2.45.1