机器人 - 两个设备之间的通信机器人、两个、通信、设备

由网友(无药可医╰)分享简介:什么是安装在两台设备的Andr​​oid应用程序相互沟通的最佳方式是什么?该设备可以直接连接,而无需使用短信?What is the best way for an Android app installed on two devices to communicate with each other? Can the...

什么是安装在两台设备的Andr​​oid应用程序相互沟通的最佳方式是什么?该设备可以直接连接,而无需使用短信?

What is the best way for an Android app installed on two devices to communicate with each other? Can the devices connect directly without using text messaging?

推荐答案

您可以通过蓝牙使用BluetoothSockets将它们连接起来。 Android开发者网站上有关于这个pretty的很好的文档。

You can connect them via bluetooth using BluetoothSockets. Android developer website has pretty good documentation on this.

http://developer.android.com/guide/topics/wireless/bluetooth.html

或者如果你宁愿(并有互联网在两台设备上),你可以使用普通插座的。

Or if you'd rather (and have internet on both devices), you can use regular Socket's.

http://developer.android.com/reference/java/net/ServerSocket.html用于服务器端 http://developer.android.com/reference/java/net/Socket.html对于客户端

http://developer.android.com/reference/java/net/ServerSocket.html for server side http://developer.android.com/reference/java/net/Socket.html for client side

如果您有大量的数据传输,网络插座有一个更大的数据容量和速度会更快。另一个优点是,有没有这样的事情超出范围。您可以连接两台设备随时随地上网是可用的,而与蓝牙他们必须彼此蓝牙范围

If you have a large amount of data to transfer, internet sockets have a greater data capacity and will be faster. The other advantage is that there is no such thing as "out of range". You can connect the two devices wherever internet is available, whereas with bluetooth they have to be within bluetooth range of each other

阅读全文

相关推荐

最新文章