Hello Friends,
First In androidmanifest.xml file give the permission of internet given below.
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
And Internet Connection code given below. This are simply create one checkinternetconnection() function.
So this code given below.
Code ::::::::::
First In androidmanifest.xml file give the permission of internet given below.
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
And Internet Connection code given below. This are simply create one checkinternetconnection() function.
So this code given below.
Code ::::::::::
private boolean checkInternetConnection() {
ConnectivityManager conMgr = (ConnectivityManager) getSystemService (Context.CONNECTIVITY_SERVICE);
// ARE WE CONNECTED TO THE NET
if (conMgr.getActiveNetworkInfo() != null
&& conMgr.getActiveNetworkInfo().isAvailable()
&& conMgr.getActiveNetworkInfo().isConnected()) {
return true;
} else {
Log.v(TAG, "Internet Connection Not Present");
return false;
}
}
Enjoyed.
No comments:
Post a Comment