Question

I am working with the Weemo sdk and up to now it is looking very promising. However I have encountered one problem while writing app based on it. I have registered a CallStatusChanged listener to the eventbus and I have no problem receiving the event on the receiver when the caller calls. However the WeemoCall object is not well constructed and the getCallId() method returns 0 (see the following code ). To my understanding event.getCaller will return the id of the caller so we can latter on use it to establish a call. can anyone help me to solve this ? I have attached a screenshot of the call object I took during debuging.

@WeemoEventListener
public void onCallStatusChanged(final CallStatusChangedEvent event){
    String msg = "";
    Log.i(TAG,"onCallStatusChanged" + event.toString());
    switch (event.getCallStatus()){
        case CREATED:
            msg = "call created";
            break;
    ...
        case RINGING:
            msg = "call is ringing";
            Intent i = new Intent(this, VideoCallingActivity.class);
            i.putExtra(INCOMING_CALL_ID_EXTRA, event.getCall().getCallId()); //getCallId returns 0 ?!
            startActivity(i);
            break;
    ...
    }
    Log.i(TAG,msg);
}

enter image description here

Was it helpful?

Solution

The WeemoCall.getCallId() method returns an int that is used internally as a index.
This way, the first call will have its getCallId() equals to 0, the second will have it equals to 1, and so on and so forth.

So, in order to get the corresponding WeemoCall object on your second activity, you can simply do the following:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    int callId = savedInstanceState.getInt(INCOMING_CALL_ID_EXTRA);
    WeemoCall call = Weemo.instance().getCall(callId);
}

You could also use this method that will return the current WeemoCall:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    WeemoCall call = Weemo.instance().getCurrentCall();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top