Skip to content

Correct code for notification sound in FCM not clear. #560

@eeerrrttty

Description

@eeerrrttty
      let message = {
        // notification: {
        //   title: 'Chamada de serviço',
        //   body: `R$ ${(snap.after.data().workDoing.priceCents / 100)}`
        // },
        data : {
          priority: '2',
          messageType: 'data',
          android_channel_id: 'fcm_divas_channel',
          notification_android_channel_id: 'fcm_divas_channel',
          title : 'Chamada de serviço',
          body: `R$ ${(snap.after.data().workDoing.priceCents / 100)}`,
          sound: 'divas',
          notification_title: 'Chamada de serviço',
          notification_body: `R$ ${(snap.after.data().workDoing.priceCents / 100)}`,
          notification_android_sound: 'divas',
          notification_android_priority: '2',
          notification_android_visibility: '1',
          notification_android_vibrate: '8000, 200',
          vibrate: '8000, 200',
          visibility: '1',
          notification_foreground: 'true',
          show_notification: 'true'
        },
        android: {
          collapse_key: 'a',
          priority: 'high',
          ttl: '3600s',
          notification: {
            channel_id: 'fcm_divas_channel',
            sound: 'divas',
            priority:'high'
          }
        },
        // data : {
        //   notification_android_sound: 'divas_sound'
        // },
        // data: {
        //   message: '',
        //   type: 'Call'
        // },
        token: snap.after.data().fcmToken
      }

My code:

            let channel = {
              id: 'fcm_divas_channel',
              sound: 'divas',
              vibration: [8000, 200],
              visibility: 1
            }
            window.FirebasePlugin.createChannel(channel,
              function () {
                console.log('Channel created: ' + channel.id)
              },
              function (error) {
                console.log('Set default channel error: ' + error)
              })

Why my custom sounds doesn't come to users ? I putted the correct sound divas.mp3 on my res/raw with config.xml parameters as documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions