Home>
/****
* Get network type
*
* @param context
* @return
* /
public static string getnettype (context context) {
try {
connectivitymanager connectmgr=(connectivitymanager) context
.getsystemservice (context.connectivity_service);
networkinfo info=connectmgr.getactivenetworkinfo ();
if (info == null) {
return "";
}
if (info.gettype () == connectivitymanager.type_wifi) {
return "wifi";
} else if (info.gettype () == connectivitymanager.type_mobile) {
if (info.getsubtype () == telephonymanager.network_type_cdma) {
return "cdma";
} else if (info.getsubtype () == telephonymanager.network_type_edge) {
return "edge";
} else if (info.getsubtype () == telephonymanager.network_type_evdo_0) {
return "evdo0";
} else if (info.getsubtype () == telephonymanager.network_type_evdo_a) {
return "evdoa";
} else if (info.getsubtype () == telephonymanager.network_type_gprs) {
return "gprs";
}
/*
* else if (info.getsubtype () ==
* telephonymanager.network_type_hsdpa) {return "hsdpa";} else
* if (info.getsubtype () == telephonymanager.network_type_hspa) {
* return "hspa";} else if (info.getsubtype () ==
* telephonymanager.network_type_hsupa) {return "hsupa";}
* /
else if (info.getsubtype () == telephonymanager.network_type_umts) {
return "umts";
} else {
return "3g";
}
} else {
return "";
}
} catch (exception e) {
return "";
}
}
  • Previous C # method for obtaining the serial number of a USB flash drive
  • Next Drop-down menu implemented by JS + CSS relative positioning