[英]Can I use WiFi to transfer data/messages between two android phones, not connected to a router?
I'm aware that if two Android phones are connected to a same wifi network, they can implement socket programming to transfer data between them But I actually want to know if you can use wifi as a transfer medium between two Android phones, just like you Bluetooth?我知道如果两部 Android 手机连接到同一个 wifi 网络,它们可以实现套接字编程以在它们之间传输数据但我实际上想知道您是否可以像您一样使用 wifi 作为两部 Android 手机之间的传输介质蓝牙?
For faster transmission of data over wifi can be done by using "WifiDirect"
which is a "p2p" connection. so that this will transfer the data from
one to other device without an Intermediate(Socket). For Example catch
this link in google developers wifip2p and P2P Connection with Wi-Fi这个链接在谷歌开发者wifip2p和P2P Connection with Wi-Fi
Catch a sample in Github WifiDirectFileTransfer在 Github WifiDirectFileTransfer中捕获样本
You can try to use ad-hoc networking on one phone (which has to be Android 2.2.+) to create a Wi-Fi hotspot and connect with the second phone to that.您可以尝试在一部手机(必须是 Android 2.2.+)上使用 ad-hoc 网络来创建 Wi-Fi 热点并与第二部手机连接。 I'm not sure if theres an API yet, I believe not.我不确定是否还有 API,我相信没有。 This question may help, altough it's not recommmend (See the comments in that question). 这个问题可能会有所帮助,尽管不推荐(请参阅该问题中的评论)。
With Android 2.2+ it is possible to create a WiFi hot-spot on one device so another device can connect.使用 Android 2.2+ 可以在一个设备上创建 WiFi 热点,以便另一个设备可以连接。 Internet connection on either device is not required.任一设备上的 Internet 连接都不是必需的。
What you are looking for is ad-hoc wireless networking , which is not well supported on the Android platform.您正在寻找的是ad-hoc 无线网络,它在 Android 平台上没有得到很好的支持。 (but some people have bravely rooted their phones and enabled the functionality) (但有些人勇敢地扎根手机并启用了该功能)
As an alternative, some builds of Android (rooted or not) will support WiFi hotspot functionality.作为替代方案,Android 的某些版本(无论是否根植)将支持 WiFi 热点功能。 Not all carriers will enable this.并非所有运营商都会启用此功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.