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

Abierto
#981 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
android, firebase, kotlin
Área
mobile

Línea de trabajo

No se especifica ningún archivo del repositorio ni ninguna prueba. Empieza con el payload de remoteMessage.notification y compara la ruta de canales de notificación de Android 8+ mediante chan.setSound con la ruta del constructor de notificaciones anterior mediante setSound. Reproduce el problema con los raw sounds indicados y verifica que en cada versión de Android se reproduzca el sonido solicitado por el servidor, en lugar del primer recurso raw.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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?

Lenguaje dominante
Kotlin
Estrellas
9.3k
Forks
7.4k
Merge medio
7 d 9 h
PR fusionados (30 d)
6

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de firebase/quickstart-android

Todos los issues de firebase/quickstart-android

Issues similares

Más issues de Kotlin

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.