Created
August 15, 2020 06:43
-
-
Save ayushmaniac/880da1ba38955fc306f3e6cf0c175ba0 to your computer and use it in GitHub Desktop.
This file contains 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
fun checkInternetConnection(context : Context) : Boolean { | |
val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | |
var activeNetworkInfo: NetworkInfo? = null | |
activeNetworkInfo = cm.activeNetworkInfo | |
return activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment