Java Code Examples for android.telephony.TelephonyManager#DATA_CONNECTING

The following examples show how to use android.telephony.TelephonyManager#DATA_CONNECTING . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Device.java    From AIMSICDL with GNU General Public License v3.0 6 votes vote down vote up
String getDataState(TelephonyManager tm) {
    int state = tm.getDataState();
    mDataState = "undef";
    mDataStateShort = "un";
    switch (state) {
        case TelephonyManager.DATA_DISCONNECTED:
            mDataState = "Disconnected";
            mDataStateShort = "Di";
            break;
        case TelephonyManager.DATA_CONNECTING:
            mDataState = "Connecting";
            mDataStateShort = "Ct";
            break;
        case TelephonyManager.DATA_CONNECTED:
            mDataState = "Connected";
            mDataStateShort = "Cd";
            break;
        case TelephonyManager.DATA_SUSPENDED:
            mDataState = "Suspended";
            mDataStateShort = "Su";
            break;
    }

    return mDataState;
}
 
Example 2
Source File: CellTracker.java    From AIMSICDL with GNU General Public License v3.0 6 votes vote down vote up
public void onDataConnectionStateChanged(int state) {
    switch (state) {
        case TelephonyManager.DATA_DISCONNECTED:
            mDevice.setDataState("Disconnected");
            mDevice.setDataStateShort("Di");
            break;
        case TelephonyManager.DATA_CONNECTING:
            mDevice.setDataState("Connecting");
            mDevice.setDataStateShort("Ct");
            break;
        case TelephonyManager.DATA_CONNECTED:
            mDevice.setDataState("Connected");
            mDevice.setDataStateShort("Cd");
            break;
        case TelephonyManager.DATA_SUSPENDED:
            mDevice.setDataState("Suspended");
            mDevice.setDataStateShort("Su");
            break;
    }
}
 
Example 3
Source File: Network.java    From batteryhub with Apache License 2.0 6 votes vote down vote up
public static String getDataState(Context context) {
    TelephonyManager manager = (TelephonyManager)
            context.getSystemService(Context.TELEPHONY_SERVICE);

    int dataState = manager.getDataState();

    switch (dataState) {
        case TelephonyManager.DATA_CONNECTED:
            return DATA_CONNECTED;
        case TelephonyManager.DATA_CONNECTING:
            return DATA_CONNECTING;
        case TelephonyManager.DATA_DISCONNECTED:
            return DATA_DISCONNECTED;
        default:
            return DATA_SUSPENDED;
    }
}
 
Example 4
Source File: DataIconData.java    From Status with Apache License 2.0 5 votes vote down vote up
private void onDataChanged() {
    switch (telephonyManager.getDataState()) {
        case TelephonyManager.DATA_CONNECTED:
        case TelephonyManager.DATA_CONNECTING:
            if (telephonyManager.getDataState() != TelephonyManager.DATA_DISCONNECTED) {
                switch (telephonyManager.getNetworkType()) {
                    case TelephonyManager.NETWORK_TYPE_GPRS:
                    case TelephonyManager.NETWORK_TYPE_EDGE:
                    case TelephonyManager.NETWORK_TYPE_IDEN:
                        onTextUpdate("2G");
                        return;
                    case TelephonyManager.NETWORK_TYPE_UMTS:
                    case TelephonyManager.NETWORK_TYPE_HSDPA:
                    case TelephonyManager.NETWORK_TYPE_HSUPA:
                    case TelephonyManager.NETWORK_TYPE_EVDO_0:
                    case TelephonyManager.NETWORK_TYPE_EVDO_A:
                    case TelephonyManager.NETWORK_TYPE_EVDO_B:
                    case TelephonyManager.NETWORK_TYPE_EHRPD:
                    case TelephonyManager.NETWORK_TYPE_CDMA:
                    case TelephonyManager.NETWORK_TYPE_1xRTT:
                        onTextUpdate("3G");
                        return;
                    case TelephonyManager.NETWORK_TYPE_HSPA:
                        onTextUpdate("H");
                        return;
                    case TelephonyManager.NETWORK_TYPE_HSPAP:
                        onTextUpdate("H+");
                        return;
                    case TelephonyManager.NETWORK_TYPE_LTE:
                        onTextUpdate("4G");
                        return;
                }
            }
    }

    onTextUpdate(null);
}