Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; public class Main { public static boolean isWiFiActive(Context inContext) { WifiManager mWifiManager = (WifiManager) inContext.getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = mWifiManager.getConnectionInfo(); int ipAddress = wifiInfo == null ? 0 : wifiInfo.getIpAddress(); if (mWifiManager.isWifiEnabled() && ipAddress != 0) { System.out.println("**** WIFI is on"); return true; } else { System.out.println("**** WIFI is off"); return false; } } }