Android examples for Wifi:Wifi Connection
is Wifi Enabled
//package com.java2s; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Main { public static boolean isWifiEnabled(Context context) { boolean isWifiConnect = true; ConnectivityManager cm = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); // check the networkInfos numbers NetworkInfo[] networkInfos = cm.getAllNetworkInfo(); for (int i = 0; i < networkInfos.length; i++) { if (networkInfos[i].getState() == NetworkInfo.State.CONNECTED) { if (networkInfos[i].getType() == ConnectivityManager.TYPE_MOBILE) { isWifiConnect = false; }/* www . j av a2 s . c o m*/ if (networkInfos[i].getType() == ConnectivityManager.TYPE_WIFI) { isWifiConnect = true; } } } return isWifiConnect; } }