有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java将信息从一个安卓客户端发送到多个安卓客户端

你能告诉我,在下面这两种情况下,我如何从一个安卓客户端向多个安卓客户端发送信息

1) the request from the client goes to the server and from the server to the other clients. Here I know that from the client to the server I can use webservice. My doubt is how to send information from the server the clients when the server has certain information. In this case the clients don't know when they needs to fetch information from the server. Just the server knows when it has to send information to the clients.

2) the request goes direct from the client to the other clients.


共 (2) 个答案

  1. # 1 楼答案

    使用Firebase Cloud Messaging(FCM)向其他设备发送信息

    首先,您需要register后端的每个客户端设备。 这样,假设您希望从一台设备向一组设备发送信息。您的后端可能知道发送信息的设备

    然后您的后端将需要send将信息和令牌设备发送到FCM服务器,该服务器将发送您想要的每个设备的信息

  2. # 2 楼答案

    你可以试试安卓推送通知。 一旦服务器从android客户端检索到特定信息(通过httprequest从客户端向webservice发出请求),您就可以从服务器向多个android客户端发送推送通知,一旦客户端收到推送通知,您就可以执行特定任务