From ebceb27c996aa688c2460f633fe294c8a949f7de 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 17:01:10 +0900 Subject: [PATCH] invert --- app/src/main/java/com/example/childguard/TestService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/example/childguard/TestService.java b/app/src/main/java/com/example/childguard/TestService.java index c5a455a..900cf7a 100644 --- a/app/src/main/java/com/example/childguard/TestService.java +++ b/app/src/main/java/com/example/childguard/TestService.java @@ -85,7 +85,7 @@ public class TestService extends Service { return flags; // IDが初期化されていない場合は何もしない } - if (!isNotificationChannelCreated(BACKGROUND_CHANNEL_ID)) { + if (isNotificationChannelCreated(BACKGROUND_CHANNEL_ID)) { createRunningNotificationChannel(); } Intent notificationIntent = new Intent(this, MainActivity.class); @@ -109,8 +109,8 @@ public class TestService extends Service { @Override public void onCreate() { super.onCreate(); - if (!isNotificationChannelCreated(BT_ALERT_CHANNEL_ID)) createAlertNotificationChannel(BT_ALERT_CHANNEL_ID); - if (!isNotificationChannelCreated(REPORTED_CHANNEL_ID)) createAlertNotificationChannel(REPORTED_CHANNEL_ID); + if (isNotificationChannelCreated(BT_ALERT_CHANNEL_ID)) createAlertNotificationChannel(BT_ALERT_CHANNEL_ID); + if (isNotificationChannelCreated(REPORTED_CHANNEL_ID)) createAlertNotificationChannel(REPORTED_CHANNEL_ID); } /** @@ -119,7 +119,7 @@ public class TestService extends Service { */ private boolean isNotificationChannelCreated(String channelId) { NotificationManager notificationManager = getSystemService(NotificationManager.class); - return notificationManager.getNotificationChannel(channelId) != null; + return notificationManager.getNotificationChannel(channelId) == null; } /**