Created
September 8, 2015 16:00
-
-
Save MBtech/37f2f3df5dfe5805adfd to your computer and use it in GitHub Desktop.
Code snippet to restart wifi interface (Android)
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
public static void restartwifi(Context serviceContext) throws InterruptedException { | |
WifiManager wifiManager = (WifiManager) serviceContext.getSystemService(Context.WIFI_SERVICE); | |
if(wifiManager.isWifiEnabled()) { | |
wifiManager.setWifiEnabled(false); | |
Thread.sleep(3000); | |
wifiManager.setWifiEnabled(true); | |
Thread.sleep(3000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment