0

I am trying to find a way to switch between WiFi hotspots, as the logic for hot spot switch on Android devices holds onto a hotspot even if the connection is so poor that it is useless.

I am trying to make my app better by being able to switch to another hotspot; but I have been unable to find anything on this.

Thanks

brad J
  • 542
  • 1
  • 11
  • 26

1 Answers1

0

Go through this link. It says how to connect to a network programmatically.

So, once device is connected to network, You could check if internet is available with this method:

public boolean isInternetAvailable()

    {
        try {
            InetAddress.getByName("google.com").isReachable(1000);     
            return true;
        } catch (UnknownHostException e) {
            return false;
        } catch (IOException e) {
            return false;
        }
    }

You might need a service to perform these actions in the background.

Community
  • 1
  • 1
Seshu Vinay
  • 13,560
  • 9
  • 60
  • 109
  • Thanks, but that wasn't what I was after. I have a situation where the app is attached to a hot spot that has poor connection, even though I am right next to a different hot spot with a good connection. I would like to be able to switch to the new hot spot in code. – brad J Oct 09 '13 at 00:05
  • http://stackoverflow.com/questions/9756601/how-to-remember-wifi-configuration-and-connected-network-through-out-the-reboots – Seshu Vinay Oct 09 '13 at 06:06
  • that would be helpful for you – Seshu Vinay Oct 09 '13 at 06:06