Skip to content

Instantly share code, notes, and snippets.

@JuniiiSays
Created September 1, 2022 14:28
Show Gist options
  • Save JuniiiSays/f891a6cd85e448463c8ac668521108eb to your computer and use it in GitHub Desktop.
Save JuniiiSays/f891a6cd85e448463c8ac668521108eb to your computer and use it in GitHub Desktop.
ConnectivityManager connectivityManager = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
if(networkInfo != null && networkInfo.isConnected()){
// TODO: Do sothing here if the user is Connected to the INTERNET
} else {
// TODO: Do sothing here if the user is not connected to the INTERNET
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment