final NetworkInfo info = cm.getActiveNetworkInfo();
if (info == null) {
// err on side of caution
return true;
}
final int type = info.getType();
switch (type) {
case TYPE_MOBILE:
case TYPE_MOBILE_DUN:
case TYPE_MOBILE_HIPRI:
case TYPE_MOBILE_MMS:
case TYPE_MOBILE_SUPL:
case TYPE_WIMAX:
return true;
case TYPE_WIFI:
return false;
default:
// err on side of caution
return true;
}