How to check the state of 3G in my app:
<p>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:</p>

<pre><code> 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;
    }
</code></pre>
