From 3b73621fb99d38e7967a8ad09248eaea0e8c1286 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, 19 Jan 2024 20:34:55 +0900 Subject: [PATCH] =?UTF-8?q?changessituation=E3=82=92=E5=BB=83=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/childguard/MainActivity.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/example/childguard/MainActivity.java b/app/src/main/java/com/example/childguard/MainActivity.java index fb3c249..f70bb8d 100644 --- a/app/src/main/java/com/example/childguard/MainActivity.java +++ b/app/src/main/java/com/example/childguard/MainActivity.java @@ -131,15 +131,12 @@ public class MainActivity extends AppCompatActivity { Log.d("BT", "Permission to connect bluetooth devices granted"); } registerReceiver(receiver, intentFilter); - changessituation(); } @Override protected void onResume() { super.onResume(); - changessituation(); Log.d("onResume", "called"); - Log.d("onResume", "mDocRef is null"); firebaselink(); } @@ -162,7 +159,7 @@ public class MainActivity extends AppCompatActivity { //FireBaseで更新された情報の判定 if (documentSnapshot.getBoolean("isReported") == false) {//isReportedがfalseのとき=サイト上で保護者ボタンが押されたとき if (fragment instanceof HomeFragment) {//fragementがHomeFragmentのインスタンスかの判定 - changessituation();// changessituation()メソッドを処理→アプリ側の乗降状態を変化 + ((HomeFragment) fragment).onEvent(!isInCar);//onEvent()メソッドを処理→HomeFragmentのonEvent()メソッドを処理 } } else if (isInCar) {//第三者ボタンが押されたときにisInCarがtrueのとき=乗車状態のとき→いたずら防止 int importance = NotificationManager.IMPORTANCE_DEFAULT; @@ -313,12 +310,12 @@ public class MainActivity extends AppCompatActivity { ((HomeFragment) fragment).onEvent(!isInCar); } - @Override - public void onStop() {//アプリをバックグラウンドにした時のメソッド - super.onStop(); - Intent intent = new Intent(getApplication(), TestService.class); - startService(intent);//TestServiceを起動 - } +// @Override +// public void onStop() {//アプリをバックグラウンドにした時のメソッド +// super.onStop(); +// Intent intent = new Intent(getApplication(), TestService.class); +// startService(intent);//TestServiceを起動 +// } }