Created
July 24, 2020 19:23
-
-
Save vladimirpetrovski/db32ca9dfe370b035a231ea8f51d299e 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
| val network: Network? = connectivityManager.allNetworks.find { | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | |
| connectivityManager.getNetworkCapabilities(it) | |
| .hasTransport(NetworkCapabilities.TRANSPORT_WIFI) | |
| } else { | |
| connectivityManager.getNetworkInfo(it).extraInfo == wifiSSID | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment