Android Wifi State Check checkWiFi(Context inContext)

Here you can find the source of checkWiFi(Context inContext)

Description

check Wi Fi

Declaration

public static boolean checkWiFi(Context inContext) 

Method Source Code

//package com.java2s;
import android.content.Context;

import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;

public class Main {
    public static boolean checkWiFi(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) {
            return true;
        } else {/*from w  w w .  j  a va2 s .  c  o  m*/
            return false;
        }
    }
}

Related

  1. isWifiOnline(Context context)
  2. isWifi(Context context)
  3. isWifiEnabled(Context context)
  4. isWifiConnected(Context context)
  5. isWifiConnected(Context context)
  6. isOnWifi(Context context)
  7. wifiEnable(Context context)
  8. isWifi(Context mContext)
  9. getWifiManager(Context context)