98

Is it possible to set up Android in ad-hoc peer-to-peer wifi mode? For example, I would like to have one phone broadcast a message, and have all peers in the network receive the broadcast, without having a server. I would like to use wifi since bluetooth range is more limited.

2
  • 1
    Are you talking about "Android to Android" or "Android to any" (like pc, mac, iphone, etc.)? Jun 15, 2013 at 21:19
  • 1
    @Doughy if you found any solution then please share. Sep 30, 2014 at 5:19

11 Answers 11

63

Here's a bug report on the feature you're requesting.

It's status is "reviewed" but I don't believe it's been implemented yet.

http://code.google.com/p/android/issues/detail?id=82

1
  • 21
    Please vote this bug up, anyone who has an interest in Ad Hoc on Android - I've got an app idea that's much trickier because of the lack of ad hoc Nov 7, 2010 at 2:38
14

Although Android can't find and connect to ad-hoc networks it sure can connect to Access Points. So as a work-around you can turn your Wireless Card into an Access Point using, for example, Connectify.

3
  • 3
    Any other Windows XP compatible tools available?
    – Faiz
    Jan 1, 2011 at 7:55
  • Best answer! This worked quickly and flawlessly. Connectify is very cool. Apr 12, 2011 at 14:43
  • 1
    Installing this application gave me BlueScreen!
    – Jama A.
    Jan 23, 2012 at 17:35
13

my friend and I are currently developing a java library implementing the AODV protocol (multihop routing suitable for mobile networks), in our bachelor thesis. The final 'product' includes a easy way to create/join an adhoc network on several android devices and an interface through the library, to send and receive messages. Unfortunately each type of phone such as hero, nexsus one... have a phonedepended way for createing a adhoc network so currently we are only supporting a few phones).

this means that once this project is finished, people with rooted phones can implement their distributed applications (file sharing, games, ...) by simply including the library .jar file in their android projects.

it's all open source by the way

http://code.google.com/p/adhoc-on-android/

5
  • 1
    totally forgot this post, sorry. If anyone is interested, we have just handed in our thesis today (written in English!), and i would be glad to share information. My mail is [email protected] Aug 16, 2010 at 23:01
  • 1
    I have uploaded the source code and documentation (a report) to code.google.com/p/adhoc-on-android Aug 18, 2010 at 9:55
  • is there any way out for another device @RabieJradi?
    – gumuruh
    Jul 18, 2014 at 2:49
  • If you want to support other devices the only way to go unfortunately, is to implement the required commands (depends the phone!) for setting up and tearing down an ad-hoc network and compile a new C library based on the startstopadhoc.c (the file you need to modify). You can find the source code here: code.google.com/p/adhoc-on-android/source/browse/trunk/jni/… If you are lucky the commands you need to execute may be similar as the setup as Nexus One, so simply using the existing compiled C library may be all you need. Jul 30, 2014 at 13:21
  • We basically got help to find out which commands are needed for setup by looking that the following project code.google.com/p/android-wifi-tether Jul 30, 2014 at 13:29
9

you can connect your android device to a known ad-hoc network.

edit /system/etc/wifi/tiwlan.ini

WiFiAdhoc = 1
dot11DesiredSSID = <your_network_ssid>
dot11DesiredBSSType = 0 

edit /data/misc/wifi/wpa_supplicant.conf

ctrl_interface=tiwlan0
update_config=1
eapol_version=1
ap_scan=2

if that is too simplistic, see these instructions.

1
  • 2
    This ONLY works with devices that use a Texas Instruments WIFI implementation and does NOT work without root, and does not work on every device. Aug 28, 2011 at 16:36
7

Support for peer to peer WiFi networking is available since API level 14.

2
  • 2
    Just note that there are multiple bugs loaded for WiFi P2P API. 25397 26418 26483
    – Calvin
    Mar 20, 2012 at 9:15
  • 1
    I think it works only on Wifi direct devices. As it is a new hardware feature that is available only on phones these days, we can't use it to connect to laptops.
    – abat
    Jan 5, 2013 at 23:48
6

Your answer is Wi-Fi direct which is made available with ICS. Here is a link for explanation in Android doc

4

It might work to use JmDNS on Android: http://jmdns.sourceforge.net/

There are tons of zeroconf-enabled machines out there, so this would enable discovery with more than just Android devices.

1
  • 1
    Although this link is very useful, it does not answer the question at all. ZeroConf DNS != Ad Hoc wireless. Aug 28, 2011 at 18:45
3

You can use Alljoyn framework for Peer-to-Peer connectivity in Android. Its based on Ad-hoc networking and also Open source.

1
  • the example is hard to understand @Selva I already analyze the source code of alljoyn there.
    – gumuruh
    Jul 6, 2014 at 7:58
2

I don't think it provides a multi-hop wireless packet routing environment. However you can try to integrate a simple routing mechanism. Just check out Wi-Share to get an idea how it can be done.

1
  • the concept is nice, but the code is not there... @jaxvy
    – gumuruh
    Jul 18, 2014 at 2:52
1

Yes, but:
1. root your device (in case you've got Nexus S like me, see this)
2. install root explorer (search in market)
3. find appropriate wpa_supplcant file and replace (and backup) original as shown in this thread

above was tested on my Nexus S I9023 android 2.3.6

2
  • well that's nice @kreker... so you could use wifi peer to peer using android 2.3 ? good! Could you share the tutorial for us?
    – gumuruh
    Apr 24, 2014 at 7:53
  • @gumuruh my answer is tutorial
    – k4dima
    Apr 26, 2014 at 17:58
0

In addition to Telmo Marques answer: I use Virtual Router for this.

Like connectify it creates an accesspoint on your Windows 8, Windows 7 or 2008 R2 machine, but it's open-source.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.