firebase / firebase/quickstart-android
Problem that Firebase Push Notification play first sound in the raw folder for phones above SDK 26
Nessuno ha ancora preso questa issue.
- Lingua principale
- Kotlin
- Stelle
- 9.3k
- Fork
- 7.4k
- Merge medio
- 2g 19h
- PR unite (30g)
- 8
Descrizione
Firebase Push Notification play first a sound at raw for phones above SDK 26.
- raw
1. car_park_empty.m4a
2. car_park_full.m4a
remoteMessage.notification
{
"sound":"car_park_full",
"android_channel_id":"default_channel_id",
"data":{"carParkStatus":"true"}
}
playing a sound for android 8 and above
soundUri = if (aioNotification.carparkStatus) {
Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://"+ context.packageName + "/" + R.raw.car_park_empty_tr);
} else {
Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://"+ context.packageName + "/" + R.raw.car_park_full_tr);
}
}
val attributes = AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setUsage(AudioAttributes.USAGE_NOTIFICATION)
.build()
if (soundUri != null) {
chan.setSound(
soundUri,
attributes
)
}
playing a sound for android 8 and below
var soundUri: Uri? = null
if (aioNotification.carparkStatus != null) {
soundUri = if (aioNotification.carparkStatus) {
Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://"+ context.packageName + "/" + R.raw.car_park_empty_tr);
} else {
Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://"+ context.packageName + "/" + R.raw.car_park_full_tr);
}
}
if (soundUri != null) {
notificationCompatBuilder.setSound(soundUri)
}
but notification just play first sound in the raw folder.
example -->
- raw
1. car_park_full.m4a
play => car_park_full
- raw
1. car_park_empty.m4a
2. car_park_full.m4a
play => car_park_empty
----
remoteMessage.notification
{
"sound":"car_park_full",
"android_channel_id":"default_channel_id",
"data":{"carParkStatus":"true"}
}
- raw
1. abcde.m4a
2. bcdea.m4a
2. yery.m4a
Assuming that notification comes this way and that the raw folder is that way.
The sound that plays is abcde.m4a. So It's sound where first index in the raw folder.
> Notification was sent from server.
>> Sound value was sent as 'car_park_full.m4a' from server but Sound value came as 'car_park_full' to client.
Does anyone know what the reason is?
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Non viene indicato alcun file del repository né alcun test. Inizia dal payload di remoteMessage.notification e confronta il percorso dei canali di notifica di Android 8+ che usa chan.setSound con il percorso precedente del notification builder che usa setSound. Riproduci il problema con i raw sounds elencati e verifica che su ogni versione di Android venga riprodotto il sound richiesto dal server, anziché la prima risorsa raw.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- android, firebase, kotlin
- Ambito
- mobile
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100