From a928641410814b9b91f37e4db5934a44af4a8414 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:58:59 +0900 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E8=A6=81=E3=81=AA=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E3=82=B9=E3=82=BF=E3=83=B3=E3=82=B9=E3=82=92=E4=BF=9D=E6=8C=81?= =?UTF-8?q?=E3=81=97=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= 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, 2 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/example/childguard/TestService.java b/app/src/main/java/com/example/childguard/TestService.java index fd6cc28..eca70f9 100644 --- a/app/src/main/java/com/example/childguard/TestService.java +++ b/app/src/main/java/com/example/childguard/TestService.java @@ -65,18 +65,13 @@ public class TestService extends Service { @Override public int onStartCommand(Intent intent, int flags, int startId) { - //共有プリファレンス全体の準備 - SharedPreferences sharedPreferences = getSharedPreferences("app_situation", MODE_PRIVATE); - this.userId = sharedPreferences.getString("ID", null);//アプリに記録されているIDの取得 - if (this.userId == null) { + if (getSharedPreferences("app_situation", MODE_PRIVATE).getString("ID", null) == null) { Log.d("onResume", "ID not initialized."); return flags; // IDが初期化されていない場合は何もしない - } else { - setSnapshotListener(FirebaseFirestore.getInstance().document("status/" + this.userId)); } + setSnapshotListener(FirebaseFirestore.getInstance().document("status/" + this.userId)); if (isNotBluetoothGranted()) return flags; - registerReceiver(receiver); return flags; }