twilio / audioswitch

An Android audio management library for real-time communication apps.
Apache License 2.0
163 stars 50 forks source link

java.lang.IllegalStateException when used in Services #91

Closed Feroz-Istar closed 3 years ago

Feroz-Istar commented 3 years ago

I am trying to wirk with Twilio Voice android SDK. When call is connected we are activating audio switch via code audioSwitch.activate();

But it throws

Process: salesken.ai, PID: 14657 java.lang.IllegalStateException at com.twilio.audioswitch.AudioSwitch.activate(AudioSwitch.kt:208)

What should we do to use it in Android Foreground Service?>

gileze33 commented 3 years ago

What was the solution to this @Feroz-Istar - we're seeing the exact same thing using

audioSwitch.start { _, selectedAudioDevice ->
    // crashes with IllegalStateException on the next line
    audioSwitch.activate()
}
alejojonas commented 2 years ago

Can anyone share how they're reproducing this? I can't reproduce it on my phone, but I see it in our crash analytics.

Feroz-Istar commented 2 years ago

I can see exception in crash analytics too. But not sure how to reproduce it. This might be happening when audio manager is been used in system applications and when we try to access it via our app. I haven't found any solutions yet