Actually i had used the following code to check the wifi is active or not (its working fine). I just want to confirm that can i use the same code to check the 3G active state:
public boolean checkwifi()
{
ConnectivityManager connec = (ConnectivityManager) this.getSystemService(this.CONNECTIVITY_SERVICE);
android.net.NetworkInfo wifi = connec.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
android.net.NetworkInfo mobile = connec.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
// Here if condition check for wifi and mobile network is available or not.
// If anyone of them is available or connected then it will return true, otherwise false;
if (wifi.isConnected()) {
return true;
}
else if (mobile.isConnected()) {
return true;
}
return false;
}