Android App is crashing While someone disconnect the opentok call from other devices

189 Views Asked by At

Below is my crash log

App Crashes Log Image Looks like OpenTok Android Plugin.Java is giving exception

Exception ->

2022-02-11 12:42:06.699 5702-5836/com.guardian.patientconnect I/OTPlugin: session dropped stream

beginning of crash

2022-02-11 12:42:06.754 5702-5836/com.guardian.patientconnect E/AndroidRuntime: FATAL EXCEPTION: JavaBridge Process: com.guardian.patientconnect, PID: 5702 android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:8798) at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:1606) at android.view.View.requestLayout(View.java:25390) at android.view.View.requestLayout(View.java:25390) at android.view.View.requestLayout(View.java:25390) at android.view.ViewGroup.removeView(ViewGroup.java:5463) at com.tokbox.cordova.OpenTokAndroidPlugin$RunnableSubscriber.removeStreamView(OpenTokAndroidPlugin.java:375) at com.tokbox.cordova.OpenTokAndroidPlugin.onStreamDropped(OpenTokAndroidPlugin.java:792) at com.opentok.android.Session.b(Unknown Source:4) at com.opentok.android.Session.lambda$XcZSOYrJMUjKBTVPTxPnP7btNyY(Unknown Source:0) at com.opentok.android.-$$Lambda$Session$XcZSOYrJMUjKBTVPTxPnP7btNyY.run(Unknown Source:4) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.os.HandlerThread.run(HandlerThread.java:67) 2022-02-11 12:42:06.838 532-1916/system_process W/ActivityTaskManager: Force finishing activity com.guardian.patientconnect/.MainActivity 2022-02-11 12:42:06.841 532-567/system_process W/Looper: Drained

public void onStreamDropped(Session arg0, Stream arg1) {
    Log.i(TAG, "session dropped stream");
    streamCollection.remove(arg1.getStreamId());

    streamHasAudio.remove(arg1.getStreamId());
    streamHasVideo.remove(arg1.getStreamId());
    streamVideoDimensions.remove(arg1.getStreamId());

    RunnableSubscriber subscriber = subscriberCollection.get(arg1.getStreamId());
    if (subscriber != null) {
        subscriber.removeStreamView();
        subscriberCollection.remove(arg1.getStreamId());
    }
    triggerStreamEvent(arg1, "sessionEvents", "streamDestroyed");
}

can you tell me what is the right approach

0

There are 0 best solutions below