I modified your CallService class to launch a full screen intent activity when the screen is locked. This activity contains Textview to display Caller Name & 2 buttons for Accept & Reject.
Accept Button redirects to call activity & reject button rejects the call & finishes the activity.
I Have written the follwing code on Reject Button Click
end(SendBirdCall.getCall(getIntent().getStringExtra(EXTRA_CALL_ID)));
protected void end(DirectCall call) {
Log.i(“NullDirectCall”, String.valueOf(call == null));
if (call != null) {
call.end();
}
finish();
}
But the caller’s callactivity still keeps calling & does not show as declined. From the log, the call variable is also not null.
Can you check whether DirectCallListener.onEnded()
is called on both side?
In which class we need to check the same?
You need to check whether the above event is triggered or not after you call call.end()
.
You can set it like this
call.setListener(new DirectCallListener() {
@Override
public void onConnected(DirectCall call) {
}
@Override
public void onEnded(DirectCall call) {
}
});
This is there in Application Class & CallActivity. In caller’s phone when I reject call from notification it works regardless of app in foreground or killed but when I reject from my activity (shown when screen is locked) it works only when app is not killed.
Could you check if authenticate() method is invoked before DirectCall.end() method is called.
I think the end() method needs authentication.