TestServiceの全体的なリファクタリング #28

Merged
asura146 merged 73 commits from improve/refactor_service into main 2024-07-12 02:17:26 +00:00
Showing only changes of commit 61c2abcdad - Show all commits

View File

@ -67,11 +67,18 @@ public class TestService extends Service {
} }
} }
/**
* 通知チャネルが作成されているか確認
* @return 通知チャンネルの有無 true: 作成済み false: 未作成
*/
private boolean isNotificationChannelCreated() { private boolean isNotificationChannelCreated() {
NotificationManager notificationManager = getSystemService(NotificationManager.class); NotificationManager notificationManager = getSystemService(NotificationManager.class);
return notificationManager.getNotificationChannel(CHANNEL_ID) != null; return notificationManager.getNotificationChannel(CHANNEL_ID) != null;
} }
/**
* 通知チャネルの作成
*/
private void createNotificationChannel() { private void createNotificationChannel() {
int importance = NotificationManager.IMPORTANCE_DEFAULT; int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, "通知", importance); NotificationChannel channel = new NotificationChannel(CHANNEL_ID, "通知", importance);