Code example for WifiInfo

Methods: getNetworkId

0
WifiManager myWifi;  
	    myWifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
	    WifiInfo myWifiInfo = myWifi.getConnectionInfo();
	     
	    if (myWifiInfo.getNetworkId() != -1)
	    	wifiConnection = true;
	    else 
	    	wifiConnection = false;
	} 
     
    /**timer makes the thread sleep (15 seconds right now) and then sets wifiChecking to true*/ 
    public void timer() 
    { 
    	try 
    	{ 
 			Thread.sleep(15000);
    	}  
    	catch (InterruptedException e)
 		{ 
 			// TODO Auto-generated catch block