android3g-network

How to check whether 3g is active or not in android


i am trying to check whether 3G is active or not in my handset and after that i have to fire an Intent. So plz anybody help me out Thanks in advance:)


Solution

  • another snippet from an applilcation I've written recently:

    TelephonyManager telManager;    
    telManager = (TelephonyManager) getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
    int cType = telManager.getNetworkType();
    String cTypeString;
    switch (cType) {
            case 1: cTypeString = "GPRS"; break;
            case 2: cTypeString = "EDGE"; break;
            case 3: cTypeString = "UMTS"; break;
            case 8: cTypeString = "HSDPA"; break;
            case 9: cTypeString = "HSUPA"; break;
            case 10:cTypeString = "HSPA"; break;
            default:cTypeString = "unknown"; break;
    }