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