Java tutorial
//package com.java2s; //License from project: LGPL import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Main { /** * This method is used to check whether Wi-Fi is connected or not. * @param appContext * @return */ public static boolean isWiFiConnected(Context appContext) { boolean isConnected = false; ConnectivityManager connMgr = (ConnectivityManager) appContext .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo wifi = connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (wifi != null && wifi.isAvailable()) { isConnected = true; } return isConnected; } }