Mam następujący kod, ale za każdym razem, gdy słyszę domyślny dźwięk Androida.Powiadomienia w systemie Android 8 setSound nie działa
// create channel
NotificationChannel channel = new NotificationChannel(ANDROID_CHANNEL_ID,
ANDROID_CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
// Sets whether notifications posted to this channel should display notification lights
channel.enableLights(true);
// Sets whether notification posted to this channel should vibrate.
channel.enableVibration(true);
// Sets the notification light color for notifications posted to this channel
channel.setLightColor(Color.GREEN);
// Sets whether notifications posted to this channel appear on the lockscreen or not
//channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC);
Uri uri = Uri.parse("android.resource://"+this.getPackageName()+"/" + R.raw.aperturaabductores);
AudioAttributes att = new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_NOTIFICATION)
.setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)
.build();
channel.setSound(uri,att);
To jest mój dźwięk pablomonteserin.es/aperturaabductores.wav
Nikt, naprawdę? – Ricardo
Testowany. działa w emulatorze. –
Nie działa w moim emulatorze i urządzeniu. Czy testowałeś na systemie Android 8 ?. Zwróć uwagę, że chcę załadować niestandardowy dźwięk. – Ricardo