Android: Pure P2P chat application - android

I've started to develop a chat application for Android. This app is supposed to function without internet and, most importantly, without an access point; It has to connect Android devices in a pure P2P manner.
However I've followed the following tutorials posted in android developers guide:
http://developer.android.com/training/connect-devices-wirelessly/nsd.html
http://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html#fetch
Afterwards, I've tested my app on 3 devices, the problem is one of the devices acts as an access point, preventing other devices from connecting with each other if they are connected to it.
This doesn't work for my app, because I want each user to be able to connect to multiple users at the same time.
What do you suggest I do in order to achieve pure P2P connection for my Android app?
Does the group owner acts as an access point?
EDIT
After I've done some research I found the WiFi Direct is not suitable for my project since it has to assign a device as an access point, what I'm looking for is WiFi ad hoc mode or (IBSS) in Android Anybody got any suggestion on how to start working on that?

By using bt and wifi simultaneously, you can try to extend the network further. This will require some kind of packet routing.
Also, it seems android ignores wlan cards connected to usb otg - just plugging in extra wlan dongles could allow easy extension of network.

Related

Android to iOS connect via WiFi or using Multipeer connectivity or using WiFi direct

So I am developing an APP and I need to connect multiple android and multiple Iphone to send text data without any internet connection or service provider data network.
So one of the phone will have to act as a server to relay information between them. But the app will have to decide which phone will be the server and if a phone that is the server leaves the conversation then another phone will pickup as the server this will all be done with some smart programming but before I get there.
I know Android WiFi direct can do a one to many connection setup which makes it easy to connect android phone and accomplish the task between android phone only. But the problems comes when I need to connect Iphone with the android phones. Since the Iphone must be able to act as a server as well.
I would like to know a few things:
Can I connect Android and Iphone via WiFi Direct?
Can I connect Android and Iphone using Multipeer connectivity feature on Iphone?
Is there anyway to create a soft access point using Iphone? I know android can do this via WiFi direct feature.
If non of these can work can you suggest something.
From the discussion here it doesn't look possible
I wonder though if both OS allow enough control over the WiFi transceiver if you couldn't just write an app that could what you are asking and just bypassing the built in software architecture all together. I would think Bluetooth would be too weak except in extremely dense device saturation environments, but just for proof of concept that could be another route to take. My guess though is that you just wouldn't get that level of control over any of the radios inside a phone through the current OS.

Send data between two Android devices on same network

I'm new to android programming and have a question about networking. I am creating a chess app where two players can play a game against each other on separate devices. My goal is to set this up so it works locally (the devices are near each other or on the same wifi network).
I noticed when trying to work through WiFi P2P (which thoroughly confused me) that the end goal was to get the MAC filter and IP address of the device you are connecting to. If I already have these (i.e. the user inputs them on the client device knowing these values externally) can I simply create the connection without using P2P?
In essence, can I simply start a networked android app with creating and connecting to a serversocket rather than dealing with P2P or NSD?
Thanks and sorry for any confusion,
Scott
you can use the alljyon sdk https://www.alljoyn.org/docs-and-downloads ,i had work with it and it work correctly ,you can find a sample demos one for chat in the same wirless without need the internet connection

Convert application using wifi to application using bluetooth

I have an android app, it does the following:
Connects with a server to read and update a database at the same time as others.
I want to convert this to an app that does not need an internet connection. Therefore i would like to know if its possible to have an android device acting as the server with the database, whilst multiple phones connect to it via bluetooth getting and updating the information in the database?
Thanks
Yes. It possible.
However all of your devices will have to be located nearby, so they can connect to each other through bluetooth.
You can take a look at Android Bluetooth API.
However, my recommendation would be to use Wifi instead of Bluetooth. YOu will need additional WiFi router. However, you won't need to deal with Bluetooth API in such case.
You will only need to write a server on one of Android device and the rest of devices will work the same (as now)
There are a few options to doing so, that don't involve a server. Both of them require a slightly different approach than both devices connecting to a server.
Wi-fi Direct- Only available with Android 4.0+.
Bluetooth
Personally, I have been using the Bluetooth option, and not found it terribly difficult. Essentially, you have to do the following to make it work.
Have one of the devices listen for a connection. If it is unpaired, you will have to make the device discoverable.
The second device needs to initiate a connection. It can do this by looking at the known devices and trying to connect to one, or listening for a new device
After the two devices connect, they must initiate some kind of a communication protocol. The communication is essential a serial connection.
Blue-tooth requires that the devices be within about 10 m of each other. Wi-fi direct will allow somewhat further, but as mentioned, is less supported. It is possible to allow for both communication methods, but is somewhat challenging.

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

Android Wifi direct multiple connection ad-hoc

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 !
Here is the link to the Wifi Direct Demo http://developer.android.com/resources/samples/WiFiDirectDemo/index.html
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
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
At this time only Galaxy S 2 support Wi-Fi Direct
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.
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.
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 :) ).
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.

Categories

Resources