# Android Oboe: AudioDeviceManager not updated when connecting headphones

**URL:** <https://forum.juce.com/t/android-oboe-audiodevicemanager-not-updated-when-connecting-headphones/35945>\
**Category:** Android\
**Created:** [October 31, 2019, 2:37pm UTC](https://forum.juce.com/t/android-oboe-audiodevicemanager-not-updated-when-connecting-headphones/35945 "2019-10-31T14:37:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunelasuis](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lunelasuis/32/6674_2.png) [@lunelasuis](https://forum.juce.com/u/lunelasuis)\
**Post date:** [October 31, 2019, 2:37pm UTC](https://forum.juce.com/t/android-oboe-audiodevicemanager-not-updated-when-connecting-headphones/35945/1 "2019-10-31T14:37:37Z")

</div>

Hello.  
First of all, thanks for integrating Oboe. It has bumped performance of our android app after implementing stabilized callback. supercool!

But there is bug: available audio devices are not updating. I’m on Android 9, Samsung Galaxy Note 8.

When app is started without headset connected it is using speakers, and if I connect headset it is still playing thru speakers. If I start app with headphones already connected - it is using headphones. I’ve tried to use AudioDeviceManager’s change callback to catch headphones connection but it is never called. Then I placed timer tracking list of currently available devices:

> ```
> const auto& deviceTypes = audioDeviceManager.getAvailableDeviceTypes();
> for (auto dt : deviceTypes)
> {
> DBG ("Type " + dt->getTypeName() + " default - " + String(dt->getDefaultDeviceIndex(false)));
> const auto devices = dt->getDeviceNames();
> for (auto d : devices)
> DBG (d);
> }
> 
> ```

When headset is not connected:

> Type Android Oboe default - 1  
> SM-N950F built-in earphone speaker  
> SM-N950F built-in speaker

**And when i connect headphones it remains the same**  
Lets start app with headset already connected:

> Type Android Oboe default - 2  
> SM-N950F built-in earphone speaker  
> SM-N950F built-in speaker  
> h2w wired headset

Moreover if app is running without headset, i can connect it and run any other app e.g Youtube and playback in my app will magically switch to headset.  
Please help.

P.S. I’m surprised that `audioDeviceManager.getAvailableDeviceTypes()` forces closing of current AAudio stream and rebuilding new one. Is it normal behavior?

---

<div class="post-metadata">

**Author:** ![lunelasuis](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lunelasuis/32/6674_2.png) [@lunelasuis](https://forum.juce.com/u/lunelasuis)\
**Post date:** [November 3, 2019, 3:23pm UTC](https://forum.juce.com/t/android-oboe-audiodevicemanager-not-updated-when-connecting-headphones/35945/2 "2019-11-03T15:23:11Z")

</div>

bump  
anyone else has this problem?

thanks!

---

<div class="post-metadata">

**Author:** ![donturner1](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/donturner1/32/4411_2.png) [@donturner1](https://forum.juce.com/u/donturner1)\
**Post date:** [November 5, 2019, 2:29pm UTC](https://forum.juce.com/t/android-oboe-audiodevicemanager-not-updated-when-connecting-headphones/35945/3 "2019-11-05T14:29:03Z")

</div>

This sounds similar to [https://github.com/google/oboe/issues/252](https://github.com/google/oboe/issues/252).

Please could you file an issue on the Oboe github site and we’ll investigate further there.

---

<div class="post-metadata">

**Author:** ![lunelasuis](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lunelasuis/32/6674_2.png) [@lunelasuis](https://forum.juce.com/u/lunelasuis)\
**Post date:** [November 5, 2019, 7:46pm UTC](https://forum.juce.com/t/android-oboe-audiodevicemanager-not-updated-when-connecting-headphones/35945/4 "2019-11-05T19:46:41Z")

</div>

Thanks for looking into this. I saw this issue but its not the same behavior. It was year ago so i hoped it was fixed in the patch to Pie. So its more related to Oboe problem than to AudioDeviceManager class? I will create this topic on github
