How to check Internet is Connected or not In Android
In Android Internet Connection can be checked by using ConnectivityManager class.
Note : to use this you need to declare ACCESS_NETWORK_STATE
Android Manifest
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
CODE :
boolean isInternetConnected() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE ); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); boolean isConncted = activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting(); return isConncted; }
Hi,
ReplyDeleteThanks for sharing the information with us it was very informative. Hangup.in
7992141844
ReplyDelete