android - FCM 通知 "click_action"不工作

标签 android google-cloud-functions firebase-cloud-messaging

我正在使用 Cloud Functions 并使用它发送推送通知。发送通知按预期工作,但 click_action 属性不起作用。当我点击通知时没有任何反应。这是我的代码:

我的通知负载:

const payload = {
  notification: {
      title: 'Soru Çözüm',
      body: 'Attığınz soruya bir yorum geldi: ' + data.content,
      icon: 'ic_stat_logo',
      click_action: '.activities.SoruDetayActivity'
  },
  data: {
      title: 'Soru Çözüm',
      content: 'Sorunuz çözüldü.',
      post: data.parent
  }
};

Intent 过滤器:

<activity
    android:name=".activities.SoruDetayActivity"
    android:label="Soru"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <action android:name=".activities.SoruDetayActivity"/>

        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />

        <data
            android:host="www.website.com"
            android:scheme="https" />
    </intent-filter>
</activity>

最佳答案

您的通知负载似乎是正确的。 尝试通过删除 data 和 category.BROWSABLE 标签来更改您的 Intent 过滤器,如下面的代码行:

<activity
    android:name=".activities.SoruDetayActivity"
    android:label="Soru"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <action android:name=".activities.SoruDetayActivity"/>

        <category android:name="android.intent.category.DEFAULT" />
       
    </intent-filter>
</activity>

关于android - FCM 通知 "click_action"不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64554290/

相关文章:

javascript - 触发 Firebase 函数 onUpdate 文档字段值

google-cloud-functions - 如何限制对谷歌云功能的访问,允许用户在触发时进行身份验证?

java - 从 Realm 检索聊天消息的有效方法是什么?

android - FCM 注册在模拟器中工作,但在真实设备上不工作

java - 在 Java Android 中使用 Switch/Case 语句的更简单方法

java - 在 Android 中匹配正则表达式

android - 在 Android 键盘中包含单词建议

android - 我需要在 proguard.cfg 中放入什么来启用混淆?

firebase - 使用 Firebase Functions 处理来自 Woocommerce 的多个 Webhook 时,我应该使用单个云函数还是多个云函数? (Webhook 最佳实践)

javascript - 仅接收最后发送的消息(Firebase 云消息传递)