Code example for WifiManager

Methods: getDhcpInfo

0
    } 
     
    public synchronized DhcpInfo getDhcpInfo() {
        WifiManager wifi =
                (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
        return wifi.getDhcpInfo();
    } 
     
    public synchronized InetAddress getWlanAddress() {
        return fromInt(getDhcpInfo().ipAddress);
    } 
     
    public synchronized InetAddress getBroadcastAddress() {
        DhcpInfo dhcp = getDhcpInfo();
        int broadcast = (dhcp.ipAddress & dhcp.netmask) | ~dhcp.netmask;
        return fromInt(broadcast);
    } 
}