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

Android后台Firebase推送click_action与intent-filter失效,点击通知无法启动应用

问题分析与解决方案

核心问题原因

你的配置里存在一个关键错误:SplashActivity的android:exported被设置为false。当应用处于后台状态时,Android系统需要启动该Activity响应通知点击事件,但exported="false"会阻止外部组件(包括系统通知服务)启动这个Activity,最终导致点击通知后无任何响应。

具体修复步骤

  1. 修改Manifest中SplashActivity的exported属性
    将android:exported="false"改为android:exported="true",确保系统能正常启动该Activity:
<activity
    android:name=".ui.activity.login.SplashActivity"
    android:label="@string/app_name"
    android:exported="true"
    android:screenOrientation="portrait">
    <intent-filter>
        <action android:name="DeepLinkHandlerActivity" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
  1. 验证click_action匹配性
    你的FCM消息中android.notification.click_action的值为"DeepLinkHandlerActivity",与Manifest中SplashActivity的<action>名称完全一致,这部分配置无需修改。

  2. 额外注意事项

  • 针对Android 12及以上版本,所有接收隐式Intent的Activity必须显式设置android:exported="true",否则会启动失败并抛出异常。
  • 若需处理通知携带的参数,可在SplashActivity的onCreate或onNewIntent方法中通过getIntent().getExtras()获取FCM传递的data数据。

内容的提问来源于stack exchange,提问作者윤지상

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.21 18:06:17