views:

29

answers:

1

Would this Android code be a correct way to test for http network availability during a phone call, or does it exclude networks that should be included or vice versa:

public boolean isOnline() {
    TelephonyManager tm = (TelephonyManager)
              getSystemService(Context.TELEPHONY_SERVICE);

    if (tm.getNetworkType() > TelephonyManager.NETWORK_TYPE_EDGE)
        return true;
    return false;
}
+1  A: 

Any GSM network allows network access while using the phone network. CDMA networks do not allow this. But if memory serves me correctly, when Verizon moves to LTE you should be able to network access even while on the phone. This is because they will probably use CDMA for the voice network and use LTE for data. Sprint uses WiMax for their 4G, but I do not know if they are using CDMA still for voice and using WiMax for data.

The reason GSM networks can use the data network while on the phone is because they use 2 different "networks" for both. GSM is actually the voice data and UMTS/HSPA is for web data. HSPA+ for t-mobiles "4G", which is just basically upgrades to their HSPA network.

Also any of the carriers will have access to a data network if they are connected to WiFi while on the phone.

So to really answer your question, you first need to know the voice/data network type, then you need to account for wifi, but also if they are connected to LTE, WiMax, UMTS/HSPA, or CDMA.

If they are connected to CDMA only, then there is no data network available while on the phone. But if they are on CDMA + LTE, CDMA + WiMax, CDMA + WiFi then yes they have data. If it is a GSM voice network, then they have data network.

Even after you determine that, you should also keep in mind that the data network may not be available at all for one reason or another.

Ryan Conrad