Code example for AudioManager

Methods: getMode

0
			// TODO: Do I need to put second call on hold when I answer one? 
			// Check for "second call" restriction 
			if (prefs.getBoolean("no_second_call", false))
			{ 
				AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
				if (am.getMode() == AudioManager.MODE_IN_CALL)
				{ 
					return; 
				} 
			} 
			 
			// Start tts service. 
			Intent ttsIntent = new Intent(context, TTSService.class);
			ttsIntent.putExtra(TelephonyManager.EXTRA_INCOMING_NUMBER, number);
			context.startService(ttsIntent);
 
			// Start autoAnswerIntentService. 
			context.startService(new Intent(context, AutoAnswerIntentService.class));
		} 
	} 
Stop searching for code, let great code find you!  Add Codota to your java IDE