Basic Audio Routing Sample application for Bluetooth, WiredHeadset and LoudSpeaker.
#Logic While playing audio using android devices, if you have to route audio to various outputs like earpiece/loudspeaker while wired headset is connected or Bluetooth is connected then this logic can be used. Its just part of my android experimentation. Use this code in top of your own requirement.