Showing posts with label check wi-fi in android. Show all posts
Showing posts with label check wi-fi in android. Show all posts

June 11, 2011

Checking Availability of Internet from Android

The following method returns true if internet is available and false if not available.

public boolean checkInternetAvailablity()
{
ConnectivityManager cm = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
return cm.getActiveNetworkInfo().isConnected();
}

May 11, 2011

How to Check Availability of Wi-Fi through Android

 The following method Return whether Wi-Fi is enabled or disabled.
 True if enabled otherwise false.
 
 public boolean checkWIFI()
 {
        WifiManager wm = (WifiManager) getSystemService(Context.WIFI_SERVICE);
        return wm.isWifiEnabled();
 }