Code example for WifiManager

Methods: createMulticastLockgetConnectionInfo

0
		} 
 
		// figure out our wifi address, otherwise bail 
		WifiManager wifi = (WifiManager) getSystemService( Context.WIFI_SERVICE );
 
		WifiInfo wifiinfo = wifi.getConnectionInfo();
		int intaddr = wifiinfo.getIpAddress();
 
		byte[] byteaddr = new byte[] { 
			(byte) ( intaddr & 0xff ),
			(byte) ( intaddr >> 8 & 0xff ),
			(byte) ( intaddr >> 16 & 0xff ),
			(byte) ( intaddr >> 24 & 0xff )
		}; 
		InetAddress addr = InetAddress.getByAddress( byteaddr );
		Log.d( TAG, "startProbe : wifi address=" + addr.toString() );
 
		// start multicast lock 
		mLock = wifi.createMulticastLock( "mythtv_lock" );
		mLock.setReferenceCounted( true );
		mLock.acquire();
 
		zeroConf = JmDNS.create( addr, HOSTNAME );
		zeroConf.addServiceListener( MYTHTV_FRONTEND_TYPE, this );
Connect your IDE to all the code out there  Get Codota for Java