机器人 - 两个设备之间的通信 [英] Android - communicating between two devices

查看:243
本文介绍了机器人 - 两个设备之间的通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是安装在两台设备的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.

<一个href="http://developer.android.com/guide/topics/wireless/bluetooth.html">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.

<一个href="http://developer.android.com/reference/java/net/ServerSocket.html">http://developer.android.com/reference/java/net/ServerSocket.html用于服务器端 <一href="http://developer.android.com/reference/java/net/Socket.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

这篇关于机器人 - 两个设备之间的通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆