well, I concluded that 'getNetworkInfo (6). isConnected ()' does not
work when there is no internet connection. I do'nt know why!
so it was the problem.

On Aug 2, 1:07 pm, Kostya Vasilyev <[email protected]> wrote:
> You probably want to use connectityManager.getActiveNetworkInfo
>
> And watch out for this:
>
> http://code.google.com/p/android/issues/detail?id=1232
>
> As for "application unexpectedly stop" - check the logcat.
>
> -- Kostya
>
> 02.08.2010 19:55, coy пишет:
>
>
>
>
>
> > Hi,
> > I am trying to check the internet connection. When the connection is
> > available, everything works correctly, but when there is no intetnet
> > connection the application unexpectedly stop!
>
> > Am I doing anything wrong? see:
>
> > ConnectivityManager connec =
> > (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
>
> >         if ( connec.getNetworkInfo(0).isConnected() ||
> > connec.getNetworkInfo(1).isConnected() ||
> > connec.getNetworkInfo(6).isConnected()) {
> >           //internet connection available
> >          }
> >          else{
> >                    //no internet connection
> >          }
>
> > AndroidManifest.xml
>
> > //....
> >      <uses-permission android:name="android.permission.INTERNET"></uses-
> > permission>
> >      <uses-permission
> > android:name="android.permission.ACCESS_NETWORK_STATE"></uses-
> > permission>
> > //.....
>
> > can anyone help me?
>
> --
> Kostya Vasilev -- WiFi Manager + pretty widget --http://kmansoft.wordpress.com

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