Code example for AudioManager

Methods: adjustStreamVolume

0
        AudioManager audio = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
         
        if(Build.VERSION.SDK_INT >= 8){
			FroyoDucking.looseDucking(audio);
		} else{ 
			audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_VIBRATE);
			audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_VIBRATE);
		} 
        stopSelf();
    } 
 
    @Override 
    public void onDestroy() { 
    	try{ 
    		this.unregisterReceiver(receiver);
    	} catch(Exception e){}
    	 
    	Log.d("speaker", "Speaker service shutting down");
    	 
        if (mTts != null) {
            mTts.shutdown();