0
현재 앱을 개발 중이며 알림 시스템이 잘 작동하고 있습니다. firebase에서 전화로 메시지를 보낼 때를 제외하고는 알림이 소리를 내지 않습니다 (기본 전화 소리). 문제는 내 Java 프로그램에서 잘못 될 것입니다. 코드 라인 다음알림 소리 android studio
private void sendNotification(String messageBody) {
Intent intent = new Intent(this, page1.class);//**The activity that you want to open when the notification is clicked
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("FCM Message")
.setContentText(messageBody)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());
}