DRF,Firebase FCM。发送推送通知
我正在创建一个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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将令牌在正面的方向上。
然后可以将令牌保存在您的数据库中或在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.