DRF,Firebase FCM。发送推送通知

发布于 2025-02-05 08:54:11 字数 269 浏览 2 评论 0原文

我正在创建一个DRF项目,并希望实现向设备发送推送通知。

我已经在Django设置中配置了Firebase。但是之后,我遇到了问题,因为即使是从管理员那里也无法发送测试通知,我会遇到错误: 在此处输入图像描述

我知道FCM注册令牌是必需的,但是我无能为力将其放在后端。请告知是否有人遇到了如何在后端生成注册令牌。

I am creating a DRF project and want to implement sending push notifications to devices.

I have configured firebase in Django settings. But after that I faced a problem as I can't send test notification even from admin, I get an error:
enter image description here

I understand that FCM registration token is required, but there is no way I can get it on backend side. Please advise if anyone has come across how is it possible to generate registration token on backend.

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

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

发布评论

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

评论(1

长安忆 2025-02-12 08:54:12

您应该将令牌在正面的方向上。
然后可以将令牌保存在您的数据库中或在Firebase上,无论您喜欢哪个。

You should get the token on front.end side with JS, and also have functions for receiving messages in background/foreground on front.end.
The token can then be saved in your database or on firebase, whichever you prefer.

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