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

Ouverte
#981 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
25/100
Type d'issue
Bug
Clarté
À clarifier
Activité
À l'abandon
Stack technique
android, firebase, kotlin
Domaine
mobile

Piste de recherche

Aucun fichier du dépôt ni aucun test n’est nommé. Commencez par le payload de remoteMessage.notification et comparez le chemin des canaux de notification d’Android 8+ utilisant chan.setSound avec l’ancien chemin du constructeur de notification utilisant setSound. Reproduisez le problème avec les raw sounds indiqués et vérifiez que le son demandé par le serveur, plutôt que la première ressource raw, est lu sur chaque version d’Android.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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?

Langage dominant
Kotlin
Étoiles
9.3k
Forks
7.4k
Merge moyen
7 j 9 h
PR mergées (30 j)
6

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de firebase/quickstart-android

Toutes les issues de firebase/quickstart-android

Issues similaires

Plus d'issues Kotlin

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.