Created
August 8, 2016 03:41
-
-
Save pyadav/92a1d6af31b784ce6d85bf31766aa7ed to your computer and use it in GitHub Desktop.
Check if internet is connected or not
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 boolean isNetworkConnected(Context context) { | |
| ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); | |
| NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); | |
| return (networkInfo != null && networkInfo.isConnectedOrConnecting()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment