一段时间后未收到 FCM 通知

发布于 2025-01-09 12:10:52 字数 122 浏览 3 评论 0原文

我已经在我的聊天应用程序中实现了 firebase 云消息传递,我使用改造通过 fcm 通知从源用户向目标用户发送消息,即使应用程序关闭,有时一切正常,但几个小时后我没有收到任何通知。为什么会发生这种情况?感谢任何帮助,提前致谢。

I've implemented firebase cloud messaging into my chat application, im using retrofit to send message through fcm notification from source user to destination user, everything works fine for sometime even when the app is closed, but after say some hours i don't receive any notification. Why this might be happening? any help is appreciated, thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初心 2025-01-16 12:10:52

您是否看过以下内容:https://firebase.google.com/docs/云消息/android/接收

为了继续接收,当应用程序被杀死时,您需要标记您的 Firebase 服务类,以免主应用程序被杀死。

做类似的事情(未经测试)

ComponentName componentName = new ComponentName(
      applicationContext,
      FCMService.class);

applicationContext.getPackageManager().setComponentEnabledSetting(
       componentName,
       PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
       PackageManager.DONT_KILL_APP);

这也可能有帮助: https:/ /github.com/firebase/quickstart-android/issues/41#issuecomment-306066751

Did you look about this : https://firebase.google.com/docs/cloud-messaging/android/receive ?

To keep receiving, when the app is killed, you need to mark your Firebase Service class to not get killed with your main app.

Do something like that (not tested)

ComponentName componentName = new ComponentName(
      applicationContext,
      FCMService.class);

applicationContext.getPackageManager().setComponentEnabledSetting(
       componentName,
       PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
       PackageManager.DONT_KILL_APP);

This may also help : https://github.com/firebase/quickstart-android/issues/41#issuecomment-306066751

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文