Example usage for android.net ConnectivityManager TYPE_WIFI

List of usage examples for android.net ConnectivityManager TYPE_WIFI

Introduction

In this page you can find the example usage for android.net ConnectivityManager TYPE_WIFI.

Prototype

int TYPE_WIFI

To view the source code for android.net ConnectivityManager TYPE_WIFI.

Click Source Link

Document

A WIFI data connection.

Usage

From source file:Main.java

public static boolean isUsingWiFi() {
    return ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_WIFI);
}

From source file:Main.java

public static boolean isWIFIConnection(Context context) {
    return ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_WIFI);
}

From source file:Main.java

public static boolean isWifiAvailable(Context context) {
    int type = ConnectivityManager.TYPE_WIFI;
    return isAvailableByType(context, type);
}

From source file:Main.java

public static boolean isWiFICon() {
    boolean result = false;
    if (Net_IsTest && NetType == ConnectivityManager.TYPE_WIFI)
        result = true;//from   w ww  .  j a  v  a 2s  .  c o  m
    return result;
}

From source file:Main.java

private static int isConnectionFast(int type, int subType) {
    if (type == ConnectivityManager.TYPE_WIFI) {
        return 0;
    } else if (type == ConnectivityManager.TYPE_MOBILE) {
        switch (subType) {
        case TelephonyManager.NETWORK_TYPE_1xRTT:
            return 1; // ~ 50-100 kbps
        case TelephonyManager.NETWORK_TYPE_CDMA:
            return 2; // ~ 14-64 kbps
        case TelephonyManager.NETWORK_TYPE_EDGE:
            return 3; // ~ 50-100 kbps
        case TelephonyManager.NETWORK_TYPE_GPRS:
            return 4; // ~ 100 kbps
        case TelephonyManager.NETWORK_TYPE_EVDO_0:
            return 5; // ~25 kbps 
        case TelephonyManager.NETWORK_TYPE_LTE:
            return 6; // ~ 400-1000 kbps
        case TelephonyManager.NETWORK_TYPE_EVDO_A:
            return 7; // ~ 600-1400 kbps
        case TelephonyManager.NETWORK_TYPE_HSDPA:
            return 8; // ~ 2-14 Mbps
        case TelephonyManager.NETWORK_TYPE_HSPA:
            return 9; // ~ 700-1700 kbps
        case TelephonyManager.NETWORK_TYPE_HSUPA:
            return 10; // ~ 1-23 Mbps
        case TelephonyManager.NETWORK_TYPE_UMTS:
            return 11; // ~ 400-7000 kbps
        case TelephonyManager.NETWORK_TYPE_EHRPD:
            return 12; // ~ 1-2 Mbps
        case TelephonyManager.NETWORK_TYPE_EVDO_B:
            return 13; // ~ 5 Mbps
        case TelephonyManager.NETWORK_TYPE_HSPAP:
            return 14; // ~ 10-20 Mbps
        case TelephonyManager.NETWORK_TYPE_IDEN:
            return 15; // ~ 10+ Mbps
        case TelephonyManager.NETWORK_TYPE_UNKNOWN:
        default://from   www .  j a va 2s. c om
            return -1;
        }
    } else {
        return -1;
    }
}

From source file:Main.java

public static boolean isConnectedWiFi(Context context) {
    ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    return manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnected();
}

From source file:Main.java

public static boolean isWIFI(Context context) {
    NetworkInfo info = getNetworkInfo(context);
    return null != info && info.getType() == ConnectivityManager.TYPE_WIFI;
}

From source file:Main.java

public static boolean isWifiConnected(ConnectivityManager cm) {
    if (cm != null) {
        NetworkInfo networkInfo = cm.getActiveNetworkInfo();
        if (networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
            return true;
        }//  www.  j a  va  2  s .c om
    }
    return false;
}

From source file:Main.java

public static boolean isNetworkConnectedByWifi(Context context) {
    NetworkInfo networkInfo = ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE))
            .getNetworkInfo(ConnectivityManager.TYPE_WIFI);
    return networkInfo != null && networkInfo.isConnected();
}

From source file:Main.java

public static boolean isWifi(Context context) {
    ConnectivityManager con = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    State wifi = con.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState();
    if (wifi == State.CONNECTED)
        return true;
    else/*w ww.ja  v a  2 s .  c om*/
        return false;
}