title: What is the android api for getting the list of connected audio devices?
body: <p>I used the below added code to get the connected audio devices for android device. Used AudioManager api method <code>getDevices()</code> and got the result with connected devices like earphones, speaker, headphones. But this <code>getDevices()</code> method is available since android api level 23 (Marshmallow) only.</p>
  
  <p>But my application should support from api level 21 (Lollipop). Please can anybody let me know the alternative api to get the available audio device for the android device.</p>
  
  <p>Code used with api level 23.</p>
  
  <pre><code>AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
  
  if (android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.M) {
      AudioDeviceInfo[] adi = audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
  }
  </code></pre>
  
  <p>Please help me by providing a way to get the connected audio devices for the devices running with Android OS version below Marshmallow(api level 23).</p>