本文介绍了如何在flutter中通知用户offer调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序需要 VOIP 呼叫功能,我使用 webRTC 来实现它.在 webRTC 中,接收者如何知道来电?

My apps needs a VOIP call functionality and I use webRTC to achieve it. In webRTC how the reciever knows about the incoming call?

我所有的用户都将在 Django 中注册并作为前端颤动.如果我使用 FCM 如何指定发送通知的确切用户.一些文章建议使用 UID、电子邮件和诸如此类的东西,如果我已通过 Firebase 进行身份验证,我可能知道 UID,但我使用自己的服务器 如何使这成为可能?

All my users will register in Django and flutter as a frontend. If I use FCM how can specify the exact user to send notifcation. Some articles suggest to use UID, email and such things if I have been authenticated with the firebase I might know about the UID but I use my own server How to make this possible?

如果我们使用电子邮件发送通知,即 Firebase 是否会将通知发送给特定用户?

In case if we use email to send a notification i.e., will firebase send the notification to the particular user?

推荐答案

使用 firebase 云消息传递.如果您使用 Django 或任何后端服务器,您只需在用户从应用程序注册时获取用户的 fcm 令牌.并在您的数据库中使用该令牌存储用户的电子邮件.因此,无论何时您想向特定用户发送通知,您都可以通过他们各自的 fcm 令牌触发.

Use firebase cloud messaging. If you are using Django or whatever server for the backend you just have to get the user's fcm token while user registers from the app. And in your database store the user's email with that token. So whenever you want to send a notification to a specific user you can trigger by their respective fcm token.

使用以下代码在 flutterfire 中获取用户的令牌.

Use below code to get user's token in flutterfire.

FirebaseMessaging messaging = FirebaseMessaging.instance;

// use the returned token to send messages to users from your custom server
String token = await messaging.getToken(
  vapidKey: "BGpdLRs......",
);

并通过您的 Django 后端向该用户发送通知,发出如下所示的帖子请求.

And to send a notification to that user via your Django backend make a post request like below.

使用服务 API.

URL: https://fcm.googleapis.com/fcm/send

Method Type: POST

标题:

Content-Type: application/json
Authorization: key=your api key

车身/有效载荷:

{
 "notification": {
    "title": "Your Title",
    "text": "Your Text",
  },
    "data": {
    "keyname": "any value" // Any data you want to send for your call initialization
    },
  "to" : "Token you got"
}

这篇关于如何在flutter中通知用户offer调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 22:22