Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.telephony.TelephonyManager; public class Main { /** * @param context * @return String * @throws * @Title: networkType * @Description: TODO */ public static String networkType(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(context.TELEPHONY_SERVICE); int type = tm.getNetworkType(); String typeString = "UNKNOWN"; if (type == TelephonyManager.NETWORK_TYPE_CDMA) { typeString = "CDMA"; } if (type == TelephonyManager.NETWORK_TYPE_EDGE) { typeString = "EDGE"; } if (type == TelephonyManager.NETWORK_TYPE_EVDO_0) { typeString = "EVDO_0"; } if (type == TelephonyManager.NETWORK_TYPE_EVDO_A) { typeString = "EVDO_A"; } if (type == TelephonyManager.NETWORK_TYPE_GPRS) { typeString = "GPRS"; } if (type == TelephonyManager.NETWORK_TYPE_HSDPA) { typeString = "HSDPA"; } if (type == TelephonyManager.NETWORK_TYPE_HSPA) { typeString = "HSPA"; } if (type == TelephonyManager.NETWORK_TYPE_HSUPA) { typeString = "HSUPA"; } if (type == TelephonyManager.NETWORK_TYPE_UMTS) { typeString = "UMTS"; } if (type == TelephonyManager.NETWORK_TYPE_UNKNOWN) { typeString = "UNKNOWN"; } if (type == TelephonyManager.NETWORK_TYPE_1xRTT) { typeString = "1xRTT"; } if (type == 11) { typeString = "iDen"; } if (type == 12) { typeString = "EVDO_B"; } if (type == 13) { typeString = "LTE"; } if (type == 14) { typeString = "eHRPD"; } if (type == 15) { typeString = "HSPA+"; } return typeString; } }