Any Idea???

On Fri, Aug 20, 2010 at 10:33 PM, tarek attia <[email protected]>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
>



-- 
tarek

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

Reply via email to