I know there are methods to add and connect to a wifi network
How do I connect to a specific Wi-Fi network in Android programmatically?
But what I need is to connect to a network that is already been saved by the user in the device,
Basically I want to connect to the best available network (which user has been connected to earlier) around. I can manage to find the nearby wifi signals and get their strength then I want to connect to the best one.
Also there are couple of inactive threads in SO asking the same question, unfortunately none of them has any answers:
https://stackoverflow.com/questions/24257680/connect-to-a-configured-wifi-network
https://stackoverflow.com/questions/20476702/android-how-do-you-choose-which-previously-saved-wifi-to-connect-to-and-do-it
How to connect to pre-configured Wifi in Android?
Related
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?
Can two android devices share hello message just by enabling their wifi? They should not be connected to an internet network, but just should exchange messages when wifi turned on
It is possible to send messages without being connected to an internet network.
For instance, Jott, an Android and iOS app, uses what's called a mesh network to allow users to send messages to each other when they are in close proximity. The mesh network operates on Bluetooth low energy or using a router that can reach within 100 feet of each user.
Not sure if this helps with your idea of enabling wifi, but it's something worth looking into.
I have never done this myself but I read there is thing called Wi-Fi Direct that allows phones to connect each other without a Wi-Fi access point.
https://developer.android.com/guide/topics/connectivity/wifip2p.html
Currently investigating this area will update this post if / when i find anything out. Any extra brain power will be much appreciated on this.
similar but not duplicate thread - Android : Check 3G or Wifi network is ON or Available or not on android Device
Use case.
User walking along the road using 3G. When the background service sees that networks are available :
Check if the Wifi network that we now see can be associated to.
Check if the Wifi provides an active connection (do a test ping and look for expected results)
Does the Wifi network need a Wispr Login.
If it does perform our Wispr authentication logic.
Then ONLY once we have got an active connection, switch the user off of 3G and onto that WiFi network.
Basically, can I send calls specifically using the WIFI device port whilst allowing the user to continue using 3G?
Thanks
Looks like there might be a way - Let WiFi and 3G connection work together by hacking ConnectivityService.java - but looks nasty.
Could you enable both - check for wifi connectivity and then disconnect 3g /or wifi depending on the outcome?
Since I don't have an Android 4.0 device I haven't been able to test this myself. Also I wonder if connecting device A (a smartphone) to device B (a wifi direct capable device) using Wifi direct would mean that device A would assume it is provided with internet from device B (tethering?). I am trying to make an application for device A that would communicate with a device B that does NOT provide internet, thus it would be interesting to know if such a scenario would lead to device A losing internet connectivity for the duration of the connection. Is the situation different depending on if device A is connected to internet through an AP or through 3G/4G?
Perhaps using Bluetooth would be a solution, but in my case security is an issue, and it seems to me that Wifi direct provides stronger security (WPA2).
Any info would be helpful!
/S
On Android, Wi-Fi Direct doesn't interfere with your connection to the Internet (Wi-Fi or 3G/4G). A problem may be that once your turn on the Wi-Fi (to enable Wi-Fi Direct, your phone will try to connect to one of the saved available networks and will disable your 3G connection. That is because Android (by default) doesn't support dual connection (via both Wi-Fi and 3G/4G), but there is some applications around that claim that they can provide such functionality.
I have two buttons in my app one will be on for local wifi(specially for "ati"), other will be on for if connection is specific server is available like www.google.com
Please help that how can detect the app is connected to local wifi and also how can detect that connection is available to specific server , same behavior as of Reachability in IOS programming
You can use the WifiManager class to get the state of Wi-Fi. I think only way to check whether connection to specific server is available to actually connect.