在独立的 expo android 构建中通过 FCM 推送通知不会触发 addNotificationResponseReceivedListener()

Push notifications via FCM on standalone expo android build not triggering addNotificationResponseReceivedListener()

SDK版本:39.0.3 Android 独立构建

我正在阅读有关通过 FCM 发送推送通知的文档,因为尝试 achieve expo push notifications working 失败,我尝试通过 getDevicePushTokenAsync() 发送推送通知并且一切顺利,直到我需要放置一个事件侦听器。

所以,我输入 addNotificationResponseReceivedListener(),它在 iOS 上运行良好,但在 Android 上运行不佳。是的,文档说将 experienceId 放入 FCM 请求中的数据对象中,我做了,但仍然没有结果。此外,在 firebase documentation 中列出的任何有效负载中都没有这样的字段,无论如何,我尝试过的任何方式的推送通知仍然没有成功的结果。

对工作推送通知的想法感到非常沮丧,我希望我在文档中丢失了一些东西。

尝试在 app.json 文件的 android 键下添加 "useNextNotificationsApi": true。它对我有用

问题出在 app.json,我们关闭了 OTA 更新,这会导致推送通知出现问题。

Here's expo.io 论坛上的回答