Hi!
The code below might help you
boolean chkStatus() {
boolean flag = false;
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()) {
}
else if (mobile.isAvailable()) {
flag = true;
} else {
flag = false;
}
return flag;
}
On Apr 12, 7:13 am, TreKing <[email protected]> wrote:
> On Mon, Apr 11, 2011 at 4:26 AM, Zhagan <[email protected]> wrote:
> > How to check whether N/W is present or Not in the device using Code.??
>
> 1 - Go the documentation.
> 2 - Find the search box in the upper right.
> 3 - Start typing a query. In this case, for example, "network".
> 4 - Watch as the page filters your results on the fly.
> 5 - Pick the class with a name that indicates it might do what you want.
> 6 - Find your answer in about 17 seconds.
>
> ---------------------------------------------------------------------------
> ----------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en