Android examples for android.net.wifi:Wifi State
is Current Wifi Connected
import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import java.util.List; public class Main{ public static boolean isCurrentWifiConnection(Context c, ScanResult result) {// w w w .j a v a2 s . c o m WifiInfo info = getWiFiInfo(c); return quote(result.SSID).equals(info.getSSID()); } /** * * @param c * @return Get current connection info */ public static WifiInfo getWiFiInfo(Context c) { WifiManager wifiManager = getWifiManger(c); return wifiManager.getConnectionInfo(); } private static String quote(String string) { return String.format("\"%s\"", string); } }