I am developing game in which I want to connect multiple people through wifi hotspot in game.
I followed this link but it does not fulfill the requirements needed for this scenario because I want to get device list using wifi only In which my game is installed and do the same thing exactly as Xender.
I have tried WiFi direct but that is very poor service sometimes devices are taking too long time to transfer data and even the connection gets disconnected automatically.
so It seems not good with wifi direct.
How do I create one to many connectivity in this scenario using WIFI HOTSPOT?
Related
So there's a requirement for an app that will communicate between devices if and only if its connected to the same local network.
E.G: Device A and Device B are connected to Wi-Fi network Z. The app will allow both the Devices to communicate between eachother (send messages/videos)
I've been researching the past couple of days but unable to get clarity with what I've found so far. (I'm confused between NSDManager, WifiP2pManager, etc. as to which one suits my requirement).
I just need confirmation between which concept/methodology to follow. Please help.
From my personal experience, WiFiP2PManager should do what you want. I have used it to connect two devices over the same WiFi network. It also allows your device to view all the other devices on the network and enables you to connect to them. Once you have connected to the device, you can then send messages across the WiFi network. This documentation does a good job of explaining how to use WiFi P2P and how to get started.
It also explains how to view devices on the network, how to connect with them, and how to transfer data. This should suit the requirements that you requested.
You can use NSD, but according to the documentation that is mainly used for giving your app access to services provided from other devices on the local network. It would allow your app to do file sharing with the other device by requesting a service.
After searching it up, I have concluded that WiFi Direct is the same as WiFi P2P. They both use the WiFiP2PManager.Here is a link for information about it.
You can use Network Service Discovery to find and connect to instances of your app. You can then open a socket connection to facilitate communication.
I created and example app on Android and on iOS that does this which I link to and explain in great detail here: http://brendaninnis.ca/connect-nearby-devices-part-2.html
I am working around wifi direct and NSD (Network Service Discovery) to transfer files.
NSD: where serivce has been created and can scan the other devices which are publishing the same service with in the same network.
WiFi Direct: This is used to scan the near by devices without network
WiFi P2P Network Serice Discovery: This is used scan the service near by devices where other devices provide the same service (NSD+WiFi Direct)
As per requirement, I need to give compatibilty to iOS device even though both are not in same network. I came to know that NSD is similar to Bonjour service by iOS.But this can be possible when devices are in the same network.
Is there any way to get connect to iPhone when both are not in same not network?
Ignoring the intricacies of getting Android and iOS to play nice together, it is possible to make them think they are in the same network without physically being there. If I understand you correctly, seems like you have two options:
Setup up a VPN server in network A and the device in network B connect to it. This would make the device in network B think it was on network A, and have access to all LAN services (such as NSD).
Set up VLAN trunking on a switch and put network A in the same network as B.
Option 2 would only work if they were geographically in the same area (like on the same campus). Option 1 would be preferable if they were geographically disparate, or you were unable or unwilling to make the infrastructure changes necessary to support option 2.
I want to work with Wifi connection via Android Devices (for example I want to send a command with my device to home router via Internet and my router send this command to a wifi module) when I refer to Developer Android APIs, I see a section that named "Wi-Fi Peer-to-Peer". what differences exist between wifi (working android devices with access point like home router) and "Wi-Fi Peer-to-Peer". Is "Wi-Fi Peer-to-Peer" same wifi Direct ? why Google didnt discusses about simple wifi ? please help.
WiFi P2P (Peer-to-Peer) and WiFi Direct are both the same thing.
There are two main differences between "normal" WiFi and WiFi P2P (from the developer's point of view):
A WiFi p2p connection (something you establish from code) is a direct connection between two devices. You can understand it as a sort of temporary (created for the time of the connection) "normal" WiFi network created for the purpose of communicating those two devices. A "normal" WiFi connection basically translates to a situation when a device is connected to a broadcasted (by some device - e.g. home access point, or a smartphone) WiFi network. This all basically means that to send data between two devices using WiFi P2P, those devices DO NOT have to be connected to the same WiFi network (as long as those devices know how to connect to each other using wifi p2p). Unfortunatelly good news with WiFi P2P end right here, because:
Designing a WiFi P2P connection based system is extremely difficult if you want to make it at least reasonably robust. This is mostly due to the lack of documentation on that subject (in Android Dev), and due to Android's WiFi p2p unpredictability (I know what I'm talking about - I was recently desigining such system).
You're wrong saying that Google didn't discuss "simple" WiFi. You just need to remember that connecting to "simple" WiFi is just not that complicated, so they didnt have to do a guide like they did for WiFi P2P. All information considering "normal" WiFi are there (at Android Developer), its just spread over many classes.
Tell me what you think is not discussed?
Also you should try to describe the exact thing your application needs to do (with WiFi), so I can maybe give you a hint whether you should try your luck with WiFi P2P or not.
I'm doing a research because I want to develop an app to which different devices connect.
The app can be an Android or iPhone smartphone. It will be for mountain equipment devices and sensors, so no wifi router is availabe. It needs long range, so Bluetooth is not an option.
I'm thinking on creating a hotspot in the smartphone and connect the devices to this hotspot. In this case, I'm thiking of this way of doing it:
Programatically create the hotspot in the smartphone. In Android, like this: http://www.whitebyte.info/android/android-wifi-hotspot-manager-class
Set up the name of the hotspot in the devices so they know where to connect. Pressing a button, they connect to the hotspot.
The android device broadcasts its IP, so devices know where to connect.
Devices connect and send the data.
I think this could be a real scenario, but I'm worried about:
Maybe there's a design flaw in my scenario that I'm not seing.
Batteries on the devices: how do batteries behave through "intensive" use of WIFI? (sending small amount of bytes of data every five minutes, e.g.).
The ability to replicate this scenario on an iPhone. Can it be done, or should the user manually create the hotspot to do this?
Any other feedback that I couldn't be thinking of.
Thanks.
Yes, on Android all of that can be done and should work fine.
Yes, you can programatically configure the hotspots info in the client.
Another way to make the connection (other then hotspot broadcasting its IP) is for the hotspot to reads it ARP cache, i.e. parse the cache to find the IP of all of the clients connected.
Battery could be a problem. That doesn't really sound like 'intensive' use of the wifi, but it will still consume a fair bit of battery (I find that even just having the hotspot enabled draws the battery).
I don't know the answer for iPhone.
I want to make my android connects two networks at the same time, the first one a wifi network to get internet connection and the other one ad-hoc network ( a network between mobiles to share some data), but the android can join only one network at the same time, Any ideas!!
It seems to be possible now.
Check this out:
http://developer.android.com/training/connect-devices-wirelessly/wifi-direct.html
What you are asking for can not currently be done. You can only be connected to one network at the time. However, there is a standard called WiFi direct that will allow you to do what you are asking for, but it isn't yet implemented in Android. I recently talked with an Android engineer at Google about this, and they are working on it, so it appears you will be able to what you are asking for in the near future, but not right now.
PC:
This CAN be done with microsoft's virtual wifi switcher.
You can connect to two our more wireless networks at once.
PC/Android/iPod/iPhone - Double/Triple connection:
You can connect your pc to your android phone or iPod Touch/iPhone(Jailbroken) with wifi teathering for android and usb teathering for both android an iPodTouch/iPhone.
Android/iPhone:
•Connect to cellular network and WiFi.
Virtual WiFi
research.microsoft.com/en-us/downloads/994abd5f-53d1-4dba-a9d8-8ba1dcccead7/
Create Two Threads. Use these threads to do the network connection. Threads can run simultaneously. So network connection also will process simultaneously. If you need to provide more priority for one connection set the thread priority high for that thread. Also set less thread priority for another thread.
I have one local device connection and one server connection. Initially both done in AsyncTask(If server connection is going on then i can't connect local device). But i need more preference for local device and also need to do both the communication simultaneously. so i tried this. It was working fine to me.