Code example for WifiManager

Methods: createMulticastLock

0
        } 
    } 
 
    protected void setWiFiMulticastLock(boolean enable) {
        if (multicastLock == null) {
            multicastLock = wifiManager.createMulticastLock(getClass().getSimpleName());
        } 
 
        if (enable) {
            if (multicastLock.isHeld()) {
                log.warning("WiFi multicast lock already acquired");
            } else { 
                log.info("WiFi multicast lock acquired");
                multicastLock.acquire();
            } 
        } else { 
            if (multicastLock.isHeld()) {
                log.info("WiFi multicast lock released");
                multicastLock.release();
            } else { 
                log.warning("WiFi multicast lock already released");