Created
May 26, 2018 17:21
-
-
Save mogimogitomato/aa0426fb0f8f9d3e42d64d3c4ff8c67f 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
private void testIsWifiConnect() { | |
ConnectivityManager manager = (ConnectivityManager) | |
getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); | |
if (manager != null) { | |
Network network = manager.getActiveNetwork(); | |
if (network != null) { | |
NetworkCapabilities capabilities = manager.getNetworkCapabilities(network); | |
if (capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) { | |
Toast toast = Toast.makeText(getApplicationContext(), "WiFi Connect", LENGTH_LONG); | |
toast.show(); | |
Timber.d("%s :WiFi Connect.", "testIsWifiConnect"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment