Я пытаюсь генерировать уведомления FCM со звуком. Я получаю уведомление и т.д. без проблем, но нет звука вообще. У меня все в порядке со звуком уведомлений по умолчанию. Пожалуйста, проверьте код ниже. Это для API 26 и выше.
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// The id of the channel.
String id = "xxx";
// The user-visible name of the channel.
CharSequence name = "xxx";
// The user-visible description of the channel.
String description = "xxx";
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel mChannel = new NotificationChannel(id, name, importance);
// Configure the notification channel.
mChannel.setDescription(description);
mChannel.enableLights(true);
// Sets the notification light color for notifications posted to this
// channel, if the device supports this feature.
mChannel.setLightColor(Color.RED);
mChannel.enableVibration(true);
mChannel.setVibrationPattern(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400});
mNotificationManager.createNotificationChannel(mChannel);
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// The id of the channel.
String CHANNEL_ID = "xxx";
// Create a notification and set the notification channel.
Notification notification = new Notification.Builder(this,"xxx")
.setSmallIcon(R.drawable.volusha_notifications)
.setContentText(text)
.setChannelId(CHANNEL_ID)
.setContentIntent(pendingIntent)
.setContentTitle(title)
.setAutoCancel(true)
.build();
// Issue the notification.
mNotificationManager.notify(new Random().nextInt(), notification);
Почему это происходит и как получить звук по умолчанию?