You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Firebase v1版本FCM推送无提示音问题排查

Firebase Cloud Messaging v1 推送通知无提示音解决方案

你的判断没错,问题核心是新版payload结构不符合Firebase v1的规范:旧版本里直接放在notification或data中的APNs专属配置(比如sound、content_available),在v1版本里需要放到指定的apns字段下,同时notification字段也得保留sound配置才能触发系统提示音。

以下是修正后的ColdFusion payload配置:

<cfset bodyData = '{ 
    "message": {
        "token": "#get_messages.UDID#",
        "notification": {
            "title": "test Crisis",
            "body": "#body#",
            "image": "",
            "sound": "#sounds#"
        },
        "data": {
            "title": "test Crisis",
            "body": "#body#",
            "EMB_id": "#get_messages.EMB_id#",
            "message_log_id": "#get_messages.message_log_id#",
            "reference_alertID": "#get_messages.reference_alertID#",
            "recipient": "#recipient#",
            "recipient_firstname": "#get_recipient.sub_firstname#",
            "recipient_lastname": "#get_recipient.sub_lastname#",
            "recipient_profile_image": "http://test.com/test_crisis/app_profiles/#get_recipient.app_profile_image#",
            "reply_resolve": "#get_messages.reply_resolve#",
            "reply_public": "#get_messages.reply_public#",
            "msg_type": "1",
            "tracker": "#get_messages.tracker#",
            "app_message_id": "#get_messages.app_message_id#",
            "image": ""
        },
        "apns": {
            "payload": {
                "aps": {
                    "sound": "#sounds#",
                    "content-available": 1,
                    "apns-priority": 5
                }
            }
        }
    }
}' >

关键改动说明:

  • 在notification字段中添加sound参数,确保Android和iOS的通知系统都能识别并播放提示音。
  • 新增apns顶级字段,将APNs专属配置(sound、content-available、apns-priority)放在apns.payload.aps下,这是Firebase v1版本要求的APNs参数正确位置。
  • 移除data字段中不属于自定义数据的APNs参数,避免结构冗余和解析错误。

内容的提问来源于stack exchange,提问作者Scott

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 08:32:31