Код: Выделить всё
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, CHANNEL_ID)
.setContentTitle(context.getString(R.string.alarm))
.setContentText(intent.getStringExtra("alarm_title"))
.setSmallIcon(R.drawable.bell_outline_symbolic)
.setSound(customSoundUri)
.setAutoCancel(true);
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
< /code>
i, за исключением того, что он воспроизводит звук из URI, но он воспроизводит звук уведомления по умолчанию (устанавливается настройками устройства). URI находится в библиотеке звуков устройства (например: Content: // Media/Internal/Audio/Media/13? Title = Tweetters & Canonical = 1 Подробнее здесь: https://stackoverflow.com/questions/795 ... unduri-uri