Problem that Firebase Push Notification play first sound in the raw folder for phones above SDK 26

Aperta
#981 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
android, firebase, kotlin
Ambito
mobile

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.

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
    3. 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?

Lingua principale
Kotlin
Stelle
9.3k
Fork
7.4k
Merge medio
7g 9h
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di firebase/quickstart-android

Tutte le issue di firebase/quickstart-android

Issue simili

Altre issue su Kotlin

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.