At basic level, below two code snippets can do this.
references
http://developer.android.com/reference/android/media/AudioManager.html
public static void unmuteSystemAudio()
{
try
{
AudioManager audio = (AudioManager) getAppContext().getSystemService(Context.AUDIO_SERVICE); audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
}
catch (Exception ex)
{
Utils.log("Exception while unmutting system audio");
ex.printStackTrace();
}
}
public static void muteSystemAudio()
{
try
{
AudioManager audio = (AudioManager) getAppContext().getSystemService(Context.AUDIO_SERVICE); audio.setRingerMode(AudioManager.RINGER_MODE_SILENT);
}
catch (Exception ex)
{
Utils.log("Exception while muting system audio");
ex.printStackTrace();
}
}
references
http://developer.android.com/reference/android/media/AudioManager.html
No comments:
Post a Comment