I need to wait until the android turns on Wi-Fi (you can’t just “setWifiEnabled (true)” and wait for activation right away). I need the right way to do this.
I have the code and its work, but I don’t think its the right way to get the job done (I think)
while(wifiManager.getWifiState() != 3) { try { Thread.sleep(500); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
I already checked to wait until Wi-Fi connects to android , but I did not find the answer I need.
source share