英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论