My question is that is it possible to send and receive data between multiple android devices via broadcasting over wifi without establishing p2p connection?
Our professor asked us to design a wireless network system in which you broadcast a message within your android phone, and the other android phones nearby receive it and broadcast it again so that the other phones can receive it and it continues like that. In this way, for example, when someone writes a message in a classroom or café everyone will be able to receive it and broadcast it again. (like an adhoc network system). And although my professor believes it can be achievable, I didn't find anything online like this kind of android network system. So my question is again is it possible to do something like that?
Any helpful leads and references will be appreciated.
Edit: I had to change the title of the question.
I couldn't find a proper solution so I tried the following method so far: I set up a UDP messaging app using Wifi hotspot (it works perfectly for multi clients). The phone who turns on the hotspot is the server and others who connect to it are the clients. Then, I decided to turn this system into an adhoc-like system where there would be more than one hotspot and the clients would connect to them in cycling order and serve as a bridge among these servers.(every second, they will switch to other hotspot and vice versa.) So, they will carry the messages from one network to another. (I know it is very inefficient and prone to time delays; but it is the only idea I have come up with so far.)
When I told this system to my professor, he said that it is too complicated and I just need to broadcast a message from a device to a common channel(without setting up a network connection), and other devices will listen to this broadcast channel(without connecting to a network system), receive the message and broadcast their own messages along with received ones to this channel again as I described in the question body. (he never mentions hotspot, Wifi direct, and etc.) He even told me that the only thing I need to do was to think simpler and use the properties of 802.11. But, I do not think it is that easy to set up such a wireless system, at least for Android where ad hoc systems are not supported yet. So any help will be greatly appreciated. Thanks!
The Nearby Connections API in Google Play Services released last week uses WiFi multicast: https://developers.google.com/games/services/android/nearby
It works for devices already on the same WiFi network. However, it uses a host/clients model, and doesn't work with WiFi direct or a tethered hotspot connection.
You could also use the WiFi direct APIs from ICS: https://developer.android.com/guide/topics/connectivity/wifip2p.html
You can have multiple devices connected together via WiFi direct, so firing UDP packets as #willis suggests would seem the way to go
It is implementable. Do you know the aircrack? similarly, you can receive all packets even not sent to you, and you can send any kinds of packets even not sent by you.
Related
I am developing currently an Android application that will communicate with other Android devices per Wifi. The Wifi will also provide the online connection. There is no server in this Wifi environment.
The idea was that the devices will discover each other with UDP multicast messages. But we noticed that UDP multicast often does not work on the devices. Sometimes it does, sometimes not.
To work around this issue we implemented a mechanism where the devices will store the local Ips online so that other devices will be able to retrieve them.
But this, of course, does only work if the Online State is available, which sometimes is not.
My question is, if there are other techniques with what the devices are able to connect per Wifi to the each other without knowing it´s Ip in the first place. Is there an easy way to forward the addresses per Bluetooth for example? Or could Wifi Direct be an option?
Every idea is welcome. Thanks for all of your help.
A zero configuration networking solution might work for you. There is a Nuget package called zeroconf that should work with Xamarin:
https://www.nuget.org/packages/Zeroconf/
Source code:
https://github.com/onovotny/Zeroconf
We found multiple ways to connect two device with a Peer-to-Peer connection using things like Bluetooth and Wifi direct. Problem is, each device need the user to accept or confirm the connection.
We would like to make a One to Many system where everyone can connect to one device. This device need to manage all the connections incoming without any user interaction (really independant) and then display in our activity some informations receive from all the connected device.
We're looking for some good examples on how we can do this. Thanks
Cant you just use basic TCP Server?
EDIT/Answer to comment:
Yes it is possible, here is one of my sample apps, tho servers can be created on ports above 1024
I want to make an application is via WiFi would send and receive data without sending them to a specific recipient. I explained to the example of a simple chat: The user sends a message via WiFi, but without a specific destination. As a result, his report available to all users nearby. Similarly other users can receive and send messages. I also want to realize the function of repeater, where each user's device not only receives a message from the other devices, and retransmits them to others allowing increase the coverage area of WiFi connection.
But at the moment it is not possible to send data without a specific recipient. The same WiFi Direct necessarily require pairing before data transfer. Can not specify that the recipient is unknown.
Recently I heard the news about the technology WiFi Aware, which involves greater interaction between WiFI devices. Please reply, WiFi Aware allows to do what I described above? Namely - the transfer of data and we will without a clear indication of the recipient and the need to do additional work (eg preliminary pairing between devices).
If WiFi Aware allows to do what I described - when it is expected to release its API? In particular, for Android devices. And if not - you can tell me how to implement what I need? And in general - it is technically possible?
Thank you for your time and sorry for my bad English.
You should try to look into nsd via wifi-direct. This Network Service discovery via Wifi-Direct. What this helps you to achieve is broadcast information to all listening devices.
On the device which wants to convey the information you addLocalService and on the other devices you should discoverServices. In the ServiceInfo object you can the pass the information you want to communicate to the other devices who are listening for services. Please try to study from the link attached above.
I am not very sure about how repeater will work with this.
I am looking to implement a cloud application that allows one to save contacts and if the contact also has the app on, see on a map where the contact is (if in close proximity to you).
I've been looking around towards how to do so and the first step is to establish a connection.
For my purposes, a centralized server to which apps connect and fetch repeatedly updated database information about other users is unsatisfactory as this is too "centralized" for a cloud app.
I've some experience with Bluetooth but in my opinion and experience, bluetooth is not practical as the two devices must then be in very very close proximity with each other.
Thus my question is this, how do android phones connect p2p without the use of local wifi? If that is even possible?
Thank you for your time
Thus my question is this, how do android phones connect p2p without the use of local wifi? If that is even possible?
Yes, via Bluetooth where available, but it will probably not meet your needs. So, in practice, the answer to your question is no. You will need the local wifi.
That being said, you could attempt multicast on the LAN to detect other connected devices enabled with your application. If you want more than LAN, you will need a fully fledge solution including super peers and a P2P framework, like JXTA
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:
Is there any way of sending messages through wifi between 2 android
devices without the use of internet?
Since Ad Hoc is not supported, is there any alternative?
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.
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.
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).