简体   繁体   English

如何在两个Android设备之间传输数据?

[英]How to transfer data between two android devices?

I was wondering what options do we have to exchange data between two different android devices? 我想知道我们必须在两个不同的android设备之间交换数据的选项吗?

For example, User-A and User-B both installs my app. 例如,用户A和用户B都安装了我的应用程序。 I would like User-A to send data (possibly just a simple message or user-A's location info) to User-B. 我希望用户A将数据(可能只是一条简单的消息或用户A的位置信息)发送给用户B。

I will be glad for any useful examples or links. 我将为任何有用的示例或链接感到高兴。

Thanks!!! 谢谢!!!

Assuming user A and B are not physically close or on the same wlan, you're going to need a server between them. 假设用户A和B在物理上不靠近或不在同一局域网中,那么您将需要在它们之间使用一台服务器。 Most users are behind a NAT, so they won't be able to be sent data directly (they won't be able to open a listening socket and receive connection requests). 大多数用户都位于NAT之后,因此他们将无法直接发送数据(他们将无法打开侦听套接字并接收连接请求)。 You pretty much have to send the data from device A to a server, then have device B poll the server (or use GCM Push). 您几乎必须将数据从设备A发送到服务器,然后让设备B轮询服务器(或使用GCM Push)。

you can use bluetooth to send the data, 您可以使用蓝牙发送数据,

refer the following link 请参考以下链接

How to send a text message to a paired device through bluetooth in android? 如何在Android中通过蓝牙向配对设备发送短信?

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

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