public void ShowNotification() { NotificationManager notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); // 채널을 생성하고 시스템에 등록 (오레오 API 26 이상부터는 채널 필요) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { CharSequence name = “My Channel 1”; String description = “My Channel 1 Description”; int importance = NotificationManager.IMPORTANCE_HIGH; // HIGH 옵션은 팝업 표시됨 NotificationChannel channel = new NotificationChannel(“12345”, name, importance); // 12345는 채널 ID channel.setDescription(description); notificationManager.createNotificationChannel(channel); // 채널을 시스템에 등록 } // 알림 생성 NotificationCompat.Builder builder = new NotificationCompat.Builder(this, “12345”) // 12345는 채널 ID .setSmallIcon(R.drawable.ic_launcher_background) .setContentTitle(“My notification”) .setContentText(“Much longer text that cannot fit one line…”)…
Read More