Hi,

How to check whether the internet connection is connected or not/?..

I tried in 2 ways

*First*

ConnectivityManager connec =
(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);



            if ( connec.getNetworkInfo(0).getState() ==
NetworkInfo.State.CONNECTED ||  connec.getNetworkInfo(1).getState() ==
NetworkInfo.State.CONNECTING  ) {


 //Do something in here when we are connected

            }
            else if ( connec.getNetworkInfo(0).getState() ==
NetworkInfo.State.DISCONNECTED ||  connec.getNetworkInfo(1).getState() ==
NetworkInfo.State.DISCONNECTED   ) {


            }


*Second*


ConnectivityManager ConMgr =
 (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
     NetworkInfo netInfo = ConMgr.getActiveNetworkInfo();
     if(netInfo != null) {

     } else{

     }


But i'm not getting ...
Wat to do?

Any one can give suggestion for this?...

-- 
Thanks & Regards
Sasikumar.S

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to