How to check data connection
<p>Thanks for previous replies,</p>

<p>I tried to check the data connection through code, I used</p>

<pre><code>final ConnectivityManager connMgr = (ConnectivityManager) this
            .getSystemService(Context.CONNECTIVITY_SERVICE);
final android.net.NetworkInfo wifi = connMgr
            .getNetworkInfo(ConnectivityManager.TYPE_WIFI);
final android.net.NetworkInfo mobile = connMgr
            .getNetworkInfo(ConnectivityManager.TYPE_MOBILE);

if (wifi.isAvailable()) {
    return true;
    } else if (mobile.isAvailable()) {
        /*
         * check.setImageResource(R.drawable.tick);
         * check.setVisibility(View.VISIBLE); noInterntet.setText("");
         */
        return true;
    } else {
        return false;
    }
</code></pre>

<p>But this code check the data availability from android version 1.6, when i run this code in 1.5, it never check the data availability, i always return true even i disabled GPRS and Wifi. is there anything other than this to check the data availability. Dont know where i made mistake. </p>
