I've been working on a React Native native plugin for Android that integrates Twilio. I forked rogchap's excellent plugin and built from that. I have had a difficult time with accepting calls using the Twilio SDK. My changes are located in this file:
I can successfully accept a Twilio call using this code, and the call works as expected, but when I disconnect the call, and the code attempts to emit an event over the bridge to javascript-world, I get a crash. It's actually not even the emit that causes the crash; if I dereference the DeviceEventEmitter at all, I get a crash (in my code above, I actually catch the disconnect event and just call toString(); this causes a crash). I should point out that I have checked for null, and the reference is fine. Any thoughts? This is the first time I've worked with a native plugin; is this symtopmatic of any common issues? I should note that this only occurs if I stay on the call for about 1.5 minutes. I'm running Android 5.0.2 on a Samsung S6. Thanks!