10

I try to create an ad-hoc network between many Android devices, but I can't find documentation to do that.

I thought Wifi direct could work for what I want, but is it possible to have multiple connection on one device ? I saw that we could do a device acting like an access point and communicate with many devices, but can we communicate from one client device to two access point devices ?

I have for example 3 devices: A -> B -> C

The "A" device need to communicate with "C" device but he's too far away, so I want to have ad-hoc wifi direct connection between A&B and ad-hoc wifi direct connection between B&C, so A can communicate with C. It should also work with more than 3 devices.

Thanks !

Johan
  • 74,508
  • 24
  • 191
  • 319
Hrk
  • 2,725
  • 5
  • 29
  • 44
  • I am trying to connect three devices in the same scenario A->B->C and A wanting to send message to C through B. Were you able to achieve this using WiFi Direct on Android? – user340 Jan 06 '14 at 12:13

8 Answers8

2

Here is the link to the Wifi Direct Demo http://developer.android.com/resources/samples/WiFiDirectDemo/index.html

nwmotogeek
  • 43
  • 6
2

I have been working on establishing ad hoc communication over Android phones for a month. I am trying to create an app that could work without having 3G or access point. Main idea is to let the clients to be able transfer voice or data in a close range.

There are some guys implemented a basic system regarding almost the same topic. It basically works with Wi-Fi access point. So you need an access point in order to establish the connection. Although this is not what I am looking for, it might be helpful for others. You might need to contact them for more details.

https://sites.google.com/site/androidwalkietalkie/home

misterbaykal
  • 522
  • 5
  • 15
1

Android does not have support for ad-hoc WiFi at this time -- sorry!

Update (2019): Android has supported WiFi Direct for a while, and this answer has not been updated.

Your scenario would work. A would be able to connect with C as long as B (the group owner) is within range of both A and C.

See Android's developer documentation for more info:

https://developer.android.com/guide/topics/connectivity/wifip2p

dorkdork
  • 15
  • 1
  • 4
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • With the new LG Optimus, you can use wifi direct to communicate with others devices, have a look at the engadget video here : http://www.viddler.com/explore/engadget/videos/2313/ But I don't know if it is possible to do a chain communication A->B->C->D ... – Hrk Mar 16 '11 at 13:56
  • @Hrk: Android does not have support for WiFi Direct at this time, either. The LG Optimus may have added this, but you may not be able to manipulate it through the Android SDK, and most other devices will not have it. If you are writing an application solely for the LG Optimus, please contact LG for assistance with their WiFi Direct implementation. – CommonsWare Mar 16 '11 at 15:18
  • 2
    Ice Cream Sandwich, now has support for WiFi Direct. – Didier A. Dec 30 '11 at 03:09
  • WiFi direct is by no means an ad-hoc network. You can build your own using something like WiFi direct, but you will not get adhoc out of the box. – lostintranslation Jul 09 '15 at 13:42
  • @CommonsWare Is it possible now to have chain communication using Wi-Fi P2P https://developer.android.com/guide/topics/connectivity/wifip2p.html – pathe.kiran Aug 06 '17 at 14:25
  • @pathe.kiran: I do not know how you are defining "chain communication". If you are referring to the A->B->C scenario from the question, in theory WiFi P2P might help there. I am skeptical that there will be many scenarios where B can reach A and C but A and C cannot reach each other. – CommonsWare Aug 06 '17 at 14:27
  • @CommonsWare Suppose all devices are having list of devices names which are in range of each other. For chain communication, device A wants to send data to device C which is in B's range. A will broadcast msg so B will create hotspot and then device A will send his msg (data + destination device name) to B then as soon as data is received by B , it will shutdown his hotspot and will broadcast msg so device C will know device B is having some msg. So C will create hotspot and then B sends msg to C. – pathe.kiran Aug 06 '17 at 14:47
1

Ad hoc wifi is disabled in Android. You need to ask Google why they have chosen to do so. If you have access to a device that allow you to install custom Android images, you will be able to patch Android to support it. Or you can root your device and reenable ad hoc Wifi, there are plenty of solutions on the web on how to enable ad hoc on rooted Android devices. This is a software issue, the hardware on every Android device that I know of has support for ad hoc Wifi.

Andy
  • 2,469
  • 1
  • 25
  • 25
  • Thx for your answer, but even if you root your device. Could it be possible to do what I want ? Communicate from A to D through B and C ? A->B->C->D – Hrk Mar 17 '11 at 20:35
  • Yes, but you would need to setup some form of routing, most easily inside your app. If data passed between devices inside your app, the data could also be passed from A to B, and then from B to C etc. – Andy Apr 17 '11 at 11:10
  • Thanks again, you tell me it's possible to have on B 2 active wifi connection (to A and to C) ? – Hrk Apr 27 '11 at 07:12
  • Yes, on a rooted phone in ad hoc mode. – Andy Jul 08 '11 at 08:50
1

At this time only Galaxy S 2 support Wi-Fi Direct

Anton Vahmin
  • 339
  • 1
  • 4
  • 15
1

The wifi direct supports concurrent hosting and client capabilities on single interface. Which means, the device will act as an AP, allowing other devices to connect to it as clients, And also connect to another AP as a client. And can share internet connection by driving the internet traffic between the interfaces. However, current implementations of wifi direct on android are specific to the phone and not part of andorid sdk. So there is not much clarity if they support concurrency. This capability is not limited by hardware.

SMK
  • 11
  • 1
1

The Serval Project, based in part on WiFi Tether, is the only place I've found this functionality. It's still alpha phase, but seems to be the forerunner in the field. The wiki is much more useful than the main project page linked above, with installation instructions and a bit of documentation.

Serval may or may not be right for your needs, but I felt it should be pointed out that ad-hoc networking is not impossible on Android. It might be better to wait until Google gets around to implementing it as standard API, though (if you believe they ever will :) ).

wohanley
  • 434
  • 5
  • 14
1

Well You might be interested in looking at AllJoyn. It is qualcoms SDK for android OS which includes wi-fi peer-to-peer implementations by creating adhoc connections. This is same as Wi-Fi Direct.

Sandeep
  • 18,356
  • 16
  • 68
  • 108