thanks Kostya Vasilyev,
I tried like this
void chkStatus()
{
final ConnectivityManager connMgr = (ConnectivityManager)
this.getSystemService(Context.CONNECTIVITY_SERVICE);
final android.net.NetworkInfo wifi =
connMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
final android.net.NetworkInfo mobile =
connMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if( wifi.isConnected() ){
Toast.makeText(this, "Wifi" , Toast.LENGTH_LONG).show();
}
else if( mobile.isAvailable() ){
Toast.makeText(this, "Mobile 3G " , Toast.LENGTH_LONG).show();
}
else
{Toast.makeText(this, "No Network " , Toast.LENGTH_LONG).show();}
}
my problem is in my mobile wifi is on but there is no network..it's showing
wifi in the toast..
i want to show if no network is there then there is a toast which represents
no network.
Thanks in advance.
Regards,
Abhilash
2010/12/21 Kostya Vasilyev <[email protected]>
> ConnectivityManager (look it up in the sdk reference).
>
> --
> Kostya Vasilyev -- http://kmansoft.wordpress.com
> 21.12.2010 15:35 пользователь "Abhilash baddam" <
> [email protected]> написал:
>
> > Hi friends,
> >
> > How can we know programmatically whether the mobile is
> > connected to internet or not either by mobile network or wifi.
> >
> >
> >
> >
> >
> >
> > Regards,
> > Abhilash
> >
> > --
> > 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]<android-developers%[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 post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[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 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