Code example for WifiManager.WifiLock

Methods: isHeld, release

0
            mPlayer.release();
            mPlayer = null;
        } 
 
        // we can also release the Wifi lock, if we're holding it 
        if (mWifiLock.isHeld()) {
            mWifiLock.release();
        } 
    } 
 
    void giveUpAudioFocus() { 
        if (mAudioFocus == AudioFocus.Focused && mAudioFocusHelper != null
            && mAudioFocusHelper.abandonFocus()) {
            mAudioFocus = AudioFocus.NoFocusNoDuck;
        } 
    } 
 
    /** 
     * Reconfigures MediaPlayer according to audio focus settings and starts/restarts it. This 
     * method starts/restarts the MediaPlayer respecting the current audio focus state. So if we 
     * have focus, it will play normally; if we don't have focus, it will either leave the