On Sat, Aug 21, 2010 at 1:25 AM, DanH <danhi...@ieee.org> wrote:

> First you have to define "connected to the internet".  You might be
> connected to the local router, eg, but it might not have a route out.
> You might even have a connection to a large network (eg, a
> university), but not be able to get past some firewall to the "rest of
> the world".
>
> I mean by "Connected to the internet" to have an internet Gateway .....I
want to ensure that I'm connected to the internet not just a network without
an internet gateway



> On Aug 20, 2:33 pm, tarek attia <tarek.m.at...@gmail.com> wrote:
> > Hi all,
> >
> > In my application I must use the internet connection ,so I check it first
> > before I open an URL connection using this :-
> >
> > public boolean IsConnectedToNetwork(ConnectivityManager conManager)
> >  {
> >       NetworkInfo allNetworkInfo = conManager.getActiveNetworkInfo();
> >       NetworkInfo currNetworkInfo;
> >       boolean anythingConnected = false;
> >     for (int i = 0; i < allNetworkInfo.length; i++)
> >     {
> >        currNetworkInfo = allNetworkInfo[i];
> >
> >        if (currNetworkInfo.getState() == NetworkInfo.State.CONNECTED)
> >             {
> >        anythingConnected=true;
> >             }
> >
> >     }
> >
> >      return anythingConnected;
> >  }
> >
> > However this code runs well when I connected to either the operator
> internet
> > Or to a Wi-fi network .
> >
> > But when I'm connected to the operator but without credit and no internet
> > the mobile also sees it as there's internet,or even connected to a Wi-fi
> > network but without internet gateway it also sees as if it's connected to
> > the internet
> >
> > Any Idea how can ensure that I'm connected to the internet ??
> >
> > --
> >
> > tarek
>
> --
> 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<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
tarek

-- 
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