Search code examples
androidandroid-serviceandroid-handlerplivoandroid-thread

During Incoming Call If I used Thread then App Crash using Plivo SDK and get Fatal signal 6 (SIGABRT), code -6


I am using Service for checking the status of Plivo Login and Handler can perform this action on Service Class and I called service from another Activity. If Incoming call is coming then Immediately App crash. And I get this Error.

“A/libc: ../src/pj/os_core_unix.c:692: pj_thread_this: assertion "!"Calling pjlib from unknown/external thread. You must " "register external threads with pj_thread_register() " "before calling any pjlib functions."" failed

A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 9296 (MyService)


Solution

  • Plivo Sales Engineer here.

    This problem might occur when you have initialised the endpoint in the main activity and pass it's reference to the service. You could try initialising the endpoint and callbacks (like onIncomingCall, onLogin) in the service and when the callback occurs, invoke the main activity from a runnable. Like this -

    Runnable runnable = new Runnable() {
    @Override
        public void run() {
            // call main activity or any other class function here..
        }
    };
    new Thread(runnable).start();
    

    You can raise a support ticket here for further assistance.