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

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

问题描述:

I was wondering what options do we have to exchange data between two different android devices?

For example, User-A and User-B both installs my app. I would like User-A to send data (possibly just a simple message or user-A's location info) to User-B.

I will be glad for any useful examples or links.

Thanks!!!

我想知道我们在两个不同的Android设备之间交换数据有什么选择? p> \ n

例如,User-A和User-B都安装了我的应用程序。 我希望User-A将数据(可能只是一条简单的消息或用户A的位置信息)发送给User-B。 p>

我会很高兴任何有用的示例或链接。

谢谢!!! p> div>

Assuming user A and B are not physically close or on the same wlan, you're going to need a server between them. 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). 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).

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?