我正在使用 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/