2

My device is an Android MiniTV mk808c.

The device defaults the Audio Output to audio_hdmi. I need the device to default to audio_codec OR change to audio_codec automatically. I can do this manually via a menu under settings->sound->audio output

From what I understand "audio output mode is a setting - audio.routing. It accepts the values 2 (CODEC), 1024 (HDMI) and 4096 (S/PDIF). "

Any help would be greatly appreciated. I need to write a one line app or if you have any other idea?

2 Answers2

1
    audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
    audioManager.setParameters("audio_devices_out_active=AUDIO_CODEC");
jdm
  • 11
  • 1
  • 1
    Even though this code might be obvious to the experienced user you could make this post more informative by providing a brief explanation. – Kris Jul 24 '14 at 20:14
  • 2
    Thanks for providing an answer. Would you be able to provide a bit more guidance than just the code? More details on writing good answers can be found [in the help on "How to Answer"](http://stackoverflow.com/help/how-to-answer) – NT3RP Jul 24 '14 at 20:14
1

audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE); audioManager.setParameters("audio_devices_out_active=AUDIO_CODEC");

The above code is correct. But it needs the below permission to work in AndroidManifest.xml

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />

Prabakaran
  • 128
  • 1
  • 9