【问题标题】:the notification throw firebase work but without sound通知抛出firebase工作但没有声音
【发布时间】:2021-03-31 18:49:12
【问题描述】:

我正在使用云功能(firebase)发送通知,它工作正常但没有声音,我不知道为什么.. 有什么想法吗?

  await FirebaseMessaging.instance.setForegroundNotificationPresentationOptions(
    alert: true,
    badge: true,
    sound: true,
  );

我尝试了这段代码,但我仍然收到没有声音的通知

【问题讨论】:

  • 在 Android 或 iOS 中?
  • @AbhiTripathi 在 iOS 上

标签: firebase flutter google-cloud-functions


【解决方案1】:

添加

sound: default,

在数据或通知中。像这样

{

data: {
    
    ..........        
  },
  notification: {
         sound: default,
       }
}

在您的 JSON 请求中。

【讨论】:

  • 我应该在哪里添加这个?
  • 在您发送到 Firebase 服务器的 JSON 中。如果您正在使用 firebase 控制台进行测试,它将无法正常工作。如果您现在没有服务器,请使用邮递员手动发送通知。
猜你喜欢
  • 2023-03-13
  • 1970-01-01
  • 2019-03-26
  • 2018-08-09
  • 2016-10-23
  • 2016-12-01
  • 1970-01-01
  • 2021-09-21
  • 1970-01-01
相关资源
最近更新 更多