Skip to content

Instantly share code, notes, and snippets.

View AhmedKamal1992's full-sized avatar

Ahmed Kamal AhmedKamal1992

View GitHub Profile
@AhmedKamal1992
AhmedKamal1992 / NetworkUtils.java
Created October 23, 2017 12:04
Internet Connection basic functions check
public class NetworkUtils {
public static NetworkInfo getNetworkInfo(final Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
return cm.getActiveNetworkInfo();
}
public static boolean isConnected(final Context context) {
NetworkInfo info = getNetworkInfo(context);