Hello,
You can use following function to check whether internet connection is available or not.
private boolean isNetAvailable() {
ConnectivityManager conMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = conMgr.getActiveNetworkInfo();
if (null == netInfo)
{
return false;
}
else
return true;
}
You will also require to add following entry in manifest file.
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Regards,