Android examples for android.net.wifi:Wifi State
is Wifi Available
import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.NetworkInfo; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; public class Main{ public static boolean isWifiAvailable(Context context) { ConnectivityManager conMan = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); State wifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI) .getState();// w ww.j a va 2s . co m if (State.CONNECTED == wifi) { return true; } else { return false; } } }