feat: 알림음 시스템 - Android 6개 NotificationChannel 추가

- 결제/수주/발주/계약/일반/긴급 채널 추가
- 각 채널별 커스텀 알림음 파일 추가 (wav)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-01-07 20:10:19 +09:00
parent 2b34bb90ff
commit 30376a5b74
7 changed files with 64 additions and 12 deletions

View File

@@ -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);
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.