Example usage for android.net ConnectivityManager TYPE_DUMMY

List of usage examples for android.net ConnectivityManager TYPE_DUMMY

Introduction

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

Prototype

int TYPE_DUMMY

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

Click Source Link

Document

Dummy data connection.

Usage

From source file:li.barter.utils.Utils.java

/**
 * Reads the network info from service and sets up the singleton
 *//*from w  w w  .  ja v a 2s .c om*/
public static void setupNetworkInfo(final Context context) {

    final ConnectivityManager connManager = (ConnectivityManager) context
            .getSystemService(Context.CONNECTIVITY_SERVICE);
    final NetworkInfo activeNetwork = connManager.getActiveNetworkInfo();
    if (activeNetwork != null) {
        DeviceInfo.INSTANCE.setNetworkConnected(activeNetwork.isConnectedOrConnecting());
        DeviceInfo.INSTANCE.setCurrentNetworkType(activeNetwork.getType());
    } else {
        DeviceInfo.INSTANCE.setNetworkConnected(false);
        DeviceInfo.INSTANCE.setCurrentNetworkType(ConnectivityManager.TYPE_DUMMY);
    }

    Logger.d(TAG, "Network State Updated Connected: %b Type: %d", DeviceInfo.INSTANCE.isNetworkConnected(),
            DeviceInfo.INSTANCE.getCurrentNetworkType());
}

From source file:com.shinymayhem.radiopresets.ServiceRadioPlayer.java

protected int getConnectionType() {
    int newState = mNetworkInfo.getType();
    if (LOCAL_LOGV) {
        String str = "";

        switch (newState) {
        case ConnectivityManager.TYPE_WIFI:
            str += "wifi";
            break;
        case ConnectivityManager.TYPE_MOBILE:
            str += "mobile";
            break;
        case ConnectivityManager.TYPE_MOBILE_DUN:
            str += "mobile-dun";
            break;
        case ConnectivityManager.TYPE_MOBILE_HIPRI:
            str += "moblie-hipri";
            break;
        case ConnectivityManager.TYPE_MOBILE_MMS:
            str += "mobile-mms";
            break;
        case ConnectivityManager.TYPE_MOBILE_SUPL:
            str += "mobile-supl";
            break;
        case ConnectivityManager.TYPE_WIMAX:
            str += "wimax";
            break;
        case ConnectivityManager.TYPE_ETHERNET:
            str += "ethernet";
            break;
        case ConnectivityManager.TYPE_BLUETOOTH:
            str += "bluetooth";
            break;
        case ConnectivityManager.TYPE_DUMMY:
            str += "dummy";
            break;
        }/* w w w  .  j  a va 2  s .c  o m*/
        str += " detected";
        log(str, "v");
    }
    return newState;
}