[英]DRF, Firebase FCM. Sending push notifications
I am creating a DRF project and want to implement sending push notifications to devices.我正在创建一个 DRF 项目并希望实现向设备发送推送通知。
I have configured firebase in Django settings.我在 Django 设置中配置了 firebase。 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.我知道 FCM 注册令牌是必需的,但我无法在后端获取它。 Please advise if anyone has come across how is it possible to generate registration token on backend.
请告知是否有人遇到过如何在后端生成注册令牌。
You should get the token on front.end side with JS, and also have functions for receiving messages in background/foreground on front.end.您应该使用JS在front.end端获取令牌,并且还具有在front.end的后台/前台接收消息的功能。 The token cand then be saved in your database or on firebase, whichever you preffer.
然后可以将令牌保存在您的数据库或 firebase 中,无论您喜欢哪个。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.