使用服务器端函数和API向特定用户发送FCM推送通知

huangapple go评论67阅读模式
英文:

Send push notification with FCM to specific users using serverside functions with api

问题

我是相对新手,对于 Firebase 不太熟悉,所以我想使用 Firebase 和 React Native 创建一个 Android 应用程序。我想制作一个可以在产品特价时通知我的应用程序。我会使用一个 TextInput,可以在其中输入产品名称,然后将其发送到 Firestore 数据库。

现在假设有多个用户,他们等待不同的产品特价,我该如何处理呢?我知道,如果用户使用 Google 或电子邮件登录应用程序,他们会有一个用户ID之类的东西。

我的想法是创建一个服务器函数,使用 API 从网站获取特价产品,然后可能与每个用户进行比较,看是否有任何值与特价匹配。

但在那之后,我该如何继续,如何向这些用户发送推送通知?

英文:

I'm pretty new to firebase so I wanted to create a android app using firebase and React Native. I want to make an app that notifies me when a product is on offer. I would use a TextInput where I can write down the product and sends it to the firestore database.
Now let's say there are multiple users and they wait for different products to get on offer, how do I handle that. I know if a user logs into the app using google or email they have a userID or something like that.

My idea would be a server function that uses a api to get the product that are on offer from the website and then maybe compares it to every user if any values match with the offer.
But how do I proceed after that, how do I send the push notification to this users?

答案1

得分: 1

Firebase Cloud Messaging可以将通知推送并发送到指定的设备。您可以通过Firebase控制台或Firebase管理SDK来推送通知。

在根据您的业务逻辑出现新优惠时,应该使用Firebase管理SDK来推送通知。

英文:

Firebase Cloud Messaging push and deliver notification to the specified devices. You can push notifications through Firebase Console or Firebase Admin SDK.

You should use Firebase Admin SDK to push notifications when there're new offers depending on your business logic.

huangapple
  • 本文由 发表于 2023年2月18日 07:37:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/75490157.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定