【问题标题】:Firebase notification setSound() not working with React-NativeFirebase 通知 setSound() 不适用于 React-Native
【发布时间】:2020-01-26 23:10:37
【问题描述】:

我正在尝试创建一个通道来接收声音通知,我正在从 Firebase 云消息传递 发送通知,并将声音设置为 Actived。我确实在 android/app/src/main/res/raw 中有一个名为 alert.mp3 的文件,并且我尝试使用 .setSound('alert.mp3')。这是我当前的代码:

const channel = new firebase.notifications
        .Android.Channel('tarotPt', 'Tarot Pt', firebase.notifications.Android.Importance.Max)
        .setSound('alert')
        .enableLights(true)
        .enableVibration(true);

    firebase.notifications().android.createChannel(channel);

【问题讨论】:

    标签: android reactjs firebase react-native push-notification


    【解决方案1】:

    经过几天的努力,我发现我的代码运行良好,问题出在我的模拟器上。我使用的是Android Studio Emulator,当我使用真实设备时,它可以正常工作。

    【讨论】:

      猜你喜欢
      • 2020-06-24
      • 2020-10-29
      • 2022-10-13
      • 1970-01-01
      • 2018-08-05
      • 1970-01-01
      • 2018-11-15
      • 1970-01-01
      • 2022-10-05
      相关资源
      最近更新 更多