Java tutorial
//package com.java2s; import android.content.Context; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; public class Main { /** * Returns true if WiFi connection was established * @param context - used to get connectivity manger * @return true if WiFi connection established, otherwise - false. */ public static boolean isWifiConnected(Context context) { final WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); final WifiInfo wifiInfo = wifiManager.getConnectionInfo(); if (wifiInfo == null) return false; return wifiInfo.getIpAddress() != 0; } }