diff --git a/android/app/src/main/java/com/codebridgex/webapp/MainActivity.java b/android/app/src/main/java/com/codebridgex/webapp/MainActivity.java index 685374b..5573468 100644 --- a/android/app/src/main/java/com/codebridgex/webapp/MainActivity.java +++ b/android/app/src/main/java/com/codebridgex/webapp/MainActivity.java @@ -13,8 +13,12 @@ import com.getcapacitor.BridgeActivity; public class MainActivity extends BridgeActivity { // 채널 ID (FCM payload의 android.notification.channel_id 로 사용할 값) - public static final String CHANNEL_DEFAULT = "push_default"; - public static final String CHANNEL_URGENT = "push_urgent"; + public static final String CHANNEL_DEFAULT = "push_default"; + public static final String CHANNEL_URGENT = "push_urgent"; + public static final String CHANNEL_PAYMENT = "push_payment"; + public static final String CHANNEL_SALES_ORDER = "push_sales_order"; + public static final String CHANNEL_PURCHASE_ORDER = "push_purchase_order"; + public static final String CHANNEL_CONTRACT = "push_contract"; @Override protected void onCreate(Bundle savedInstanceState) { @@ -28,40 +32,88 @@ public class MainActivity extends BridgeActivity { NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); if (nm == null) return; - // 이미 존재하면 생성 안 함 (중복 방지) + // 이미 모든 채널이 존재하면 생성 안 함 (중복 방지) if (nm.getNotificationChannel(CHANNEL_DEFAULT) != null - && nm.getNotificationChannel(CHANNEL_URGENT) != null) { + && nm.getNotificationChannel(CHANNEL_URGENT) != null + && nm.getNotificationChannel(CHANNEL_PAYMENT) != null + && nm.getNotificationChannel(CHANNEL_SALES_ORDER) != null + && nm.getNotificationChannel(CHANNEL_PURCHASE_ORDER) != null + && nm.getNotificationChannel(CHANNEL_CONTRACT) != null) { return; } // raw 리소스 사운드 (android/app/src/main/res/raw/ 에 넣어야 함) - Uri soundDefault = Uri.parse("android.resource://" + getPackageName() + "/raw/push_default"); - Uri soundUrgent = Uri.parse("android.resource://" + getPackageName() + "/raw/push_urgent"); + Uri soundDefault = Uri.parse("android.resource://" + getPackageName() + "/raw/push_default"); + Uri soundUrgent = Uri.parse("android.resource://" + getPackageName() + "/raw/push_urgent"); + Uri soundPayment = Uri.parse("android.resource://" + getPackageName() + "/raw/push_payment"); + Uri soundSalesOrder = Uri.parse("android.resource://" + getPackageName() + "/raw/push_sales_order"); + Uri soundPurchaseOrder = Uri.parse("android.resource://" + getPackageName() + "/raw/push_purchase_order"); + Uri soundContract = Uri.parse("android.resource://" + getPackageName() + "/raw/push_contract"); AudioAttributes aa = new AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_NOTIFICATION) .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) .build(); - // 1) 기본 채널 + // 1) 기본 채널 (일반 알림) NotificationChannel chDefault = new NotificationChannel( CHANNEL_DEFAULT, - "Default Notifications", + "일반 알림", NotificationManager.IMPORTANCE_DEFAULT ); - chDefault.setDescription("General notifications"); + chDefault.setDescription("일반 알림"); chDefault.setSound(soundDefault, aa); - // 2) 긴급 채널 + // 2) 긴급 채널 (신규업체 등록) NotificationChannel chUrgent = new NotificationChannel( CHANNEL_URGENT, - "Urgent Notifications", + "신규업체 등록", NotificationManager.IMPORTANCE_HIGH ); - chUrgent.setDescription("Urgent notifications"); + chUrgent.setDescription("신규업체 등록 알림"); chUrgent.setSound(soundUrgent, aa); + // 3) 결제 채널 + NotificationChannel chPayment = new NotificationChannel( + CHANNEL_PAYMENT, + "결제 알림", + NotificationManager.IMPORTANCE_HIGH + ); + chPayment.setDescription("결제 관련 알림"); + chPayment.setSound(soundPayment, aa); + + // 4) 수주 채널 + NotificationChannel chSalesOrder = new NotificationChannel( + CHANNEL_SALES_ORDER, + "수주 알림", + NotificationManager.IMPORTANCE_DEFAULT + ); + chSalesOrder.setDescription("수주 관련 알림"); + chSalesOrder.setSound(soundSalesOrder, aa); + + // 5) 발주 채널 + NotificationChannel chPurchaseOrder = new NotificationChannel( + CHANNEL_PURCHASE_ORDER, + "발주 알림", + NotificationManager.IMPORTANCE_DEFAULT + ); + chPurchaseOrder.setDescription("발주 관련 알림"); + chPurchaseOrder.setSound(soundPurchaseOrder, aa); + + // 6) 계약 채널 + NotificationChannel chContract = new NotificationChannel( + CHANNEL_CONTRACT, + "계약 알림", + NotificationManager.IMPORTANCE_DEFAULT + ); + chContract.setDescription("계약 관련 알림"); + chContract.setSound(soundContract, aa); + nm.createNotificationChannel(chDefault); nm.createNotificationChannel(chUrgent); + nm.createNotificationChannel(chPayment); + nm.createNotificationChannel(chSalesOrder); + nm.createNotificationChannel(chPurchaseOrder); + nm.createNotificationChannel(chContract); } } \ No newline at end of file diff --git a/android/app/src/main/res/raw/push_contract.wav b/android/app/src/main/res/raw/push_contract.wav new file mode 100644 index 0000000..bc802ae Binary files /dev/null and b/android/app/src/main/res/raw/push_contract.wav differ diff --git a/android/app/src/main/res/raw/push_default.wav b/android/app/src/main/res/raw/push_default.wav index b42f6c2..949f239 100644 Binary files a/android/app/src/main/res/raw/push_default.wav and b/android/app/src/main/res/raw/push_default.wav differ diff --git a/android/app/src/main/res/raw/push_payment.wav b/android/app/src/main/res/raw/push_payment.wav new file mode 100644 index 0000000..b42f6c2 Binary files /dev/null and b/android/app/src/main/res/raw/push_payment.wav differ diff --git a/android/app/src/main/res/raw/push_purchase_order.wav b/android/app/src/main/res/raw/push_purchase_order.wav new file mode 100644 index 0000000..574dfe9 Binary files /dev/null and b/android/app/src/main/res/raw/push_purchase_order.wav differ diff --git a/android/app/src/main/res/raw/push_sales_order.wav b/android/app/src/main/res/raw/push_sales_order.wav new file mode 100644 index 0000000..2c30e45 Binary files /dev/null and b/android/app/src/main/res/raw/push_sales_order.wav differ diff --git a/android/app/src/main/res/raw/push_urgent.wav b/android/app/src/main/res/raw/push_urgent.wav index 5513ff4..e4809b4 100644 Binary files a/android/app/src/main/res/raw/push_urgent.wav and b/android/app/src/main/res/raw/push_urgent.wav differ