Created
July 26, 2020 17:09
-
-
Save GregKluska/afd355dd9148a9b844b17fd74b32bc6f to your computer and use it in GitHub Desktop.
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
| fun isConnectedToTheInternet(): Boolean { | |
| val cm = application.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | |
| try { | |
| return cm.activeNetworkInfo.isConnected | |
| } catch (e: Exception) { | |
| Log.e(TAG, "isConnectedToTheInternet: ${e.message}", ) | |
| } | |
| return false | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment