-1

I know how to Get Network type. But I need to identify the related standard to each release, grouping by GSM, WCDMA and LTE (others standards will not be used). I could filter it like this:

switch (networkType) {
    case TelephonyManager.NETWORK_TYPE_GPRS:
        tech = "GPRS";
        standard = "GSM";
        break;
    case TelephonyManager.NETWORK_TYPE_HSDPA:
        tech = "HSDPA";
        standard = "WCDMA";
        break;
}

Is there some information from Android API that I can use to retrieve this information on a elegant way?

It will help me to work with some information about mobile netowrk that is handle in diffrent ways between WCDMA, LTE and GSM.

UPDATE: It is not exactly what I am asking, but is very near. How to determine if network type is 2G, 3G or 4G

Community
  • 1
  • 1
emartinelli
  • 1,019
  • 15
  • 28

1 Answers1

0

Use NetworkInfo.

For instance, here you are a method which gives you if a device has or not network.

public Boolean hasDeviceConnectionToInternet(Context context) {
        ConnectivityManager conMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo i = conMgr.getActiveNetworkInfo();
        if (i == null)
            return false;
        if (!i.isConnected())
            return false;
        if (!i.isAvailable())
            return false;
        return true;
    }

For your case, you can ask i.getType() for getting the connection type, or i.getTypeName() for a human-readable description.

You can see API here: http://developer.android.com/reference/android/net/NetworkInfo.html

Juan Aguilar Guisado
  • 1,687
  • 1
  • 12
  • 21
  • Tks, but actually, it is not the point. `i.getTypeName()` will return for example "WIFI" or "MOBILE" and in my case I assume a mobile network. If I use `i.getSubTypeName()` it will work as `TelephonyManager teleMan = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); int networkType = teleMan.getNetworkType();` – emartinelli Oct 16 '14 at 14:50