[英]Swift Send Push Notification from user to user Firebase
I am creating an app using Swift and Firebase. 我正在使用Swift和Firebase创建一个应用程序。 When the user presses a button the app will upload some data to the real time database and send another user a Push Notification.
当用户按下按钮时,应用程序会将一些数据上传到实时数据库,并向其他用户发送“推送通知”。 Is possible by making the other user subscribe to the changes in the realtime database or will this not check for changes when the app is not in the foreground?
是否可以通过让其他用户订阅实时数据库中的更改来解决?如果应用程序不在前台,是否可以不检查更改?
Should I upload the data then use Cloud Messaging to alert the user of the new data? 我是否应该上传数据,然后使用Cloud Messaging提醒用户新数据?
Thank you 谢谢
You should use FCM for this use case. 您应该在此用例中使用FCM。 Having the app listen for changes to the database while in the background is not good for device battery, so you should have your application server listen to the database for changes then send appropriate FCM messages to let the client app know that there are changes.
让应用程序在后台监听数据库的更改不利于设备电池,因此您应该让应用程序服务器监听数据库的更改,然后发送适当的FCM消息以使客户端应用程序知道有更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.