Hello All,

I have a query here regarding how to find whether our phone has internet 
connected or not.

Using the following code

ConnectivityManager cm =
        
(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
 
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
boolean isConnected = activeNetwork != null &&
                      activeNetwork.isConnectedOrConnecting();


I was able to get the status based on the wifi connection of my phone.

If wifi is switched on then i was getting isConnected  as true else off.

what if router to which we are connecting has only LAN connection????Then here 
we cannot access internet but above code still shows 
isConnected as true which is wrong.

In android to we have any API which tells whether the router through which we 
are connecting has LAN enabled or WAN enabled

Thanks in advance




-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to