Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to exchange messages between 2 android devices through wifi?

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.

like image 584
Miky Avatar asked Aug 29 '11 11:08

Miky


People also ask

Can you text on Wifi with Android?

Tip: You can send texts over Wi-Fi even if you don't have cell service. Just use Messages as you normally would. If you're not connected to Wi-Fi, make sure cellular data is turned on: On your Android device, open the Settings app.

What is P2P in Android?

Wi-Fi Direct (also known as peer-to-peer or P2P) allows your application to quickly find and interact with nearby devices, at a range beyond the capabilities of Bluetooth. The Wi-Fi peer-to-peer (P2P) APIs allow applications to connect to nearby devices without needing to connect to a network or hotspot.


1 Answers

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).

like image 193
FunkTheMonk Avatar answered Oct 08 '22 02:10

FunkTheMonk