开发者

Can I use WiFi to transfer data/messages between two android phones, not connected to a router?

开发者 https://www.devze.com 2023-03-20 16:08 出处:网络
I\'m aware that if two Andr开发者_StackOverflowoid phones are connected to a same wifi network, they can implement socket programming to transfer data between them

I'm aware that if two Andr开发者_StackOverflowoid 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?


With Android 2.2+ it is possible to create a WiFi hot-spot on one device so another device can connect. Internet connection on either device is not required.


What you are looking for is ad-hoc wireless networking, which is not well supported on the Android platform. (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. Not all carriers will enable this.

Possible duplicate question.


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. I'm not sure if theres an API yet, I believe not. This question may help, altough it's not recommmend (See the comments in that question).


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

Catch a sample in Github WifiDirectFileTransfer

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号