Android examples for android.net.wifi:Wifi State
is Wifi Connected by getting wifi state
import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo.State; public class Main{ public static boolean isWifiConnected(Context context) { final ConnectivityManager connMgr = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); State mWifState = connMgr.getNetworkInfo( ConnectivityManager.TYPE_WIFI).getState(); if (State.CONNECTED == mWifState) { return true; } else {//from w ww. j a va 2 s . com return false; } } }