通过wifi和热点建立他们之间的关系 [英] Make relation between them by wifi and hotspot

查看:97
本文介绍了通过wifi和热点建立他们之间的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的朋友们。我是Android编程的新手

i有两个不同的应用程序,我希望通过wifi和热点,它们之间建立关系,(没有互联网,没有路由器,只有wifi和热点)。



我该怎么做?



例如将第一个应用程序中的文本框数据发送到另一个应用程序的文本框?



我尝试了什么:



i说我是新人,我不能什么都不做。

Hi my friends. I am new in android programming
i have two different app that i want make relation between them by wifi and hotspot,( without internet and without router, just by wifi and hotspot).

how can i do this?

for example send data of textbox in first app to textbox on another app??

What I have tried:

i said i am new and i can not do nothing.

推荐答案

您可以通过可用的网络API在Android中轻松完成此操作,但请记住,如果没有路由器和网络连接,您无法做到这一点。 :笑:



您的应用程序将连接到网络,并寻找网络上的任何活动客户端 - 也许其他人需要将自己显示为活动状态,并为此您也可以为他们提供应用程序并启用网络可见性。之后,您可以在套接字上传输数据。例如,Android Developer网站上的这篇文档讨论了与WiFi的点对点连接; 使用Wi-Fi创建P2P连接Android开发者 [ ^ ]这正是你所需要的。



执行网络操作Android开发者 [ ^ ]
You can do this easily in Android through the Networking APIs available, but remember you cannot do this without a router and the network connection. :laugh:

Your application will connect to the network, and look for any active clients on the network — maybe others would need to show themselves as active, and for this you can provide them with the app as well and enable the network visibility. After that, you can transfer the data on the sockets. For instance, this documentation on Android Developer website talks about peer-to-peer connectivity with WiFi; Creating P2P Connections with Wi-Fi | Android Developers[^] and this is exactly what you need.

Performing Network Operations | Android Developers[^]


您可以使用NFC(如果足够接近)或蓝牙。无需额外的硬件。
You can use either NFC (if they are close enough) or Bluetooth for this. No additional hardware required.


这篇关于通过wifi和热点建立他们之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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