This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |