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.

Community
  • 1
  • 1
Doughy
  • 4,115
  • 6
  • 36
  • 39

11 Answers11

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

Crowe T. Robot
  • 2,045
  • 17
  • 18
  • 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 – SamStephens Nov 07 '10 at 02: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.

Telmo Marques
  • 5,066
  • 1
  • 24
  • 34
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/

Rabie Jradi
  • 563
  • 4
  • 14
  • 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 jradi88@gmail.com – Rabie Jradi Aug 16 '10 at 23:01
  • 1
    I have uploaded the source code and documentation (a report) to http://code.google.com/p/adhoc-on-android/ – Rabie Jradi Aug 18 '10 at 09:55
  • is there any way out for another device @RabieJradi? – gumuruh Jul 18 '14 at 02: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: https://code.google.com/p/adhoc-on-android/source/browse/trunk/jni/startstopadhoc.c 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. – Rabie Jradi Jul 30 '14 at 13:21
  • We basically got help to find out which commands are needed for setup by looking that the following project https://code.google.com/p/android-wifi-tether/ – Rabie Jradi Jul 30 '14 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.

yanokwa
  • 1,408
  • 1
  • 12
  • 23
  • 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. – Kevin Parker Aug 28 '11 at 16:36
7

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

CGK
  • 2,662
  • 21
  • 24
  • 2
    Just note that there are multiple bugs loaded for WiFi P2P API. [25397](http://code.google.com/p/android/issues/detail?id=25397) [26418](http://code.google.com/p/android/issues/detail?id=26418) [26483](http://code.google.com/p/android/issues/detail?id=26483) – Calvin Mar 20 '12 at 09: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 05 '13 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

fatih
  • 1,171
  • 2
  • 14
  • 26
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.

3

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

Selvakumar
  • 84
  • 7
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.

jaxvy
  • 5,040
  • 1
  • 21
  • 22
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

k4dima
  • 6,070
  • 5
  • 41
  • 39
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.

Mene
  • 3,739
  • 21
  • 40