7

I am currently working on the creation of an application for mobile devices with Android which should be capable of sending and receiving messages through local means like wifi and bluetooth. After making a research about it I found out that Android doesn't have a native wifi ad hoc functionality and that the only way to achieve that is through rooting your device and patching the wpa_suplicant and some other similiar methods which are not generic for every device.

Synopsis of what I am trying to achieve:

An application for Android that scans for devices nearby and tries to connect to them automatically. If the other device also got this application isntalled then it automatically accepts any connection request it receives and when the connection is established it sends back a message which ensures that it has this app installed so that both can start exchanging messages automatically and the users don't have to allow/deny any of the sending/receiving in real time.

My questions are:

  1. Is there any way of sending messages through wifi between 2 android devices without the use of internet?
  2. Since Ad Hoc is not supported, is there any alternative?
  3. In case the answer to 2 is no , then is it possible to make one of the devices to be an access point so the other can connect to it and vice versa.
  4. As for bluetooth, is it possible to skip or automate the allow/deny pop up of an incoming connection and the pairing procedure?

I'll be glad if you could give me an answer to those and/or any suggestions.

Miky
  • 942
  • 2
  • 14
  • 29
  • 3
    Is the use of WiFi absolutely mandatory? I'm asking because this is very easy to do using Bluetooth: http://developer.android.com/resources/samples/BluetoothChat/index.html – Shlublu Aug 29 '11 at 12:02
  • 2
    I was about to paste my answer from [here](http://android.stackexchange.com/questions/12686/how-exchange-messages-between-2-android-devices-through-wifi-and-bluetooth-withou/12689#12689) but then realized the OP is same! :) – Atul Goyal Aug 29 '11 at 12:13
  • hehe Atul you are very active on these sites :) , apparently I reposted my question from android enthustiats here so I can get more suggestions. – Miky Aug 29 '11 at 15:37
  • @Shlublue thanks for the suggestion although I have already revised this example and it still requires device pairing and accepting connection manually. I am looking for automation of this process. – Miky Aug 29 '11 at 15:41

1 Answers1

4

You'll be able to communicate between two devices over wifi without a router/access point using Wifi Direct (P2P) in Android 4.0.

Otherwise, I don't believe you can achieve this over Wifi (bluetooth would be the next best alternative). Since 2.2 you can set your phone up to be a Wifi Access Point (for tethering your device's network connection), but during this time, the Wifi hardware is unavailable for normal use. If you had 3 devices it could work (1 AP, 2 connecting to it).

Is this for a constant connection, or a one-off small delivery? You could use NFC if you want to transmit a URL for example (Android Beam integrates this type of sharing in Android 4.0, but could implement it in 2.3).

FunkTheMonk
  • 10,908
  • 1
  • 31
  • 37