Android examples for android.net.wifi:Wifi State
is Wifi Connected
import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Main{ public static boolean isWifiConnected(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifiNetworkInfo = connectivityManager .getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (wifiNetworkInfo.isConnected()) { return true; }/*from ww w. j av a 2 s . c o m*/ return false; } }