From dc7b45436c3883779ccfb7f880c00b0e66c7760e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 11 Jul 2024 15:59:50 +0900 Subject: [PATCH] fix --- app/src/main/java/com/example/childguard/TestService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/com/example/childguard/TestService.java b/app/src/main/java/com/example/childguard/TestService.java index eca70f9..2d9f11d 100644 --- a/app/src/main/java/com/example/childguard/TestService.java +++ b/app/src/main/java/com/example/childguard/TestService.java @@ -65,13 +65,16 @@ public class TestService extends Service { @Override public int onStartCommand(Intent intent, int flags, int startId) { + this.userId = getSharedPreferences("app_situation", MODE_PRIVATE).getString("ID", null); if (getSharedPreferences("app_situation", MODE_PRIVATE).getString("ID", null) == null) { Log.d("onResume", "ID not initialized."); return flags; // IDが初期化されていない場合は何もしない } + setSnapshotListener(FirebaseFirestore.getInstance().document("status/" + this.userId)); if (isNotBluetoothGranted()) return flags; + registerReceiver(receiver); return flags; }