繁体   English   中英

如何在用户之间发送推送通知?

[英]How to send push notification from user to user?

尝试从用户到用户发送推送通知,UserA对项目的价值出价。 场景中,UserA更新了应用程序中的值,然后单击发送,同时UserB收到了更新值的通知。

       If UserB approves of the message(value) {
           UserA gets gets the notification of approval and proceeds to 
      final step of buying the item. 
 }  else {
sends no and UserA is updated of the denial and he sends a new value for approval
}

一个指南,以完成这项任务将不胜感激。

使用Firebase作为后端的PS

由于您已经在使用Firebase,因此非常简单。

本教程说明了执行此操作所需的一切:

https://www.raywenderlich.com/140836/firebase-tutorial-real-time-chat-2

本质上,您需要做两件事:

  1. 将数据保存到Firebase数据库。 (用户A)
  2. 侦听正在保存到数据库的新数据。 (用户B)

此外,firebase文档本身对此进行了很好的解释: https : //firebase.google.com/docs/cloud-messaging/ios/topic-messaging

您可以将Firebase与云消息传递一起使用。 因此, UserA创建该项目。 UserB感兴趣,因此他将订阅有关该项目的主题。

每次有更新时,他都会收到通知。 检查此https://firebase.google.com/docs/cloud-messaging/ios/topic-messaging

使用Apple Push Notification Service完成发送Push Notifications。 Apple提供了有关如何使用APN的文档

基本原理如图所示。

苹果关于APN的文档

从一台设备直接向另一台设备发送消息不是它的工作方式。 您必须向APN发送通知,以将其推送到其他设备。

由于您使用的是Firebase,因此建议您使用Firebase Cloud Messaging发送推送通知。

如果您只需要在应用程序中进行实时更新, Firebase事件监听器就可以正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM