Code example for AudioManager

Methods: abandonAudioFocus

0
     */ 
    private void giveUpAudioFocus() { 
        if (mAudioFocus == AudioFocus.FOCUS 
                && mAudioManager != null  
                && AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.abandonAudioFocus(this))  {
             
            mAudioFocus = AudioFocus.NO_FOCUS;
        } 
    } 
 
     
    /** 
     * Reconfigures MediaPlayer according to audio focus settings and starts/restarts it.  
     */ 
    protected void configAndStartMediaPlayer() { 
        if (mPlayer == null) {
            throw new IllegalStateException("mPlayer is NULL");
        } 
         
        if (mAudioFocus == AudioFocus.NO_FOCUS) {
            if (mPlayer.isPlaying()) {