Event
CallEvents
IExpressEngineEventHandler
You can set this handler to listen to all express SDK event,like room update,user enter or left,stream update,etc.
ZegoUIKitPrebuiltCallService.events.callEvents.setExpressEngineEventHandler(new IExpressEngineEventHandler() {
});
onBackPressed
this callback will be invoked when back button of android is pressed.if returned false,UIKit will use default action(end call or show a confirm dialog) when back button is pressed,or true if you want to custom your logic.
boolean onBackPressed();
ZegoUIKitPrebuiltCallService.events.callEvents.setBackPressEvent(new BackPressEvent() {
@Override
public boolean onBackPressed() {
return false;
}
});
onOnlySelfInRoom
user will receive this callback when all other persons leaves call.The default action is finish current call. if user override this callback ,the default action will not work,and user can add custom logic.
void onOnlySelfInRoom();
ZegoUIKitPrebuiltCallService.events.callEvents.setOnlySelfInRoomListener(new ZegoOnlySelfInRoomListener() {
@Override
public void onOnlySelfInRoom() {
}
});
onCallEnd
this listener will be invoked when call ends.The ZegoCallEndReason value can be LOCAL_HANGUP,REMOTE_HANGUP or KICK_OUT. if the callEndReason is KICK_OUT,jsonObject's value is who kicked out you.if the value is empty,means you are kicked out by server if you hangup or quit by back button, callEndReason will be LOCAL_HANGUP. if the other person ends the call, callEndReason will be REMOTE_HANGUP.
void onCallEnd(ZegoCallEndReason callEndReason, String jsonObject) ;
ZegoUIKitPrebuiltCallService.events.callEvents.setCallEndListener(new CallEndListener() {
@Override
public void onCallEnd(ZegoCallEndReason callEndReason, String jsonObject) {
}
});
onAudioOutputDeviceChanged
Audio device routing change notification. This callback is triggered when there is a change in audio routing, such as headphone insertion or removal, speaker and earpiece switching, etc.
void onAudioOutputDeviceChanged(ZegoAudioOutputDevice audioOutput);
ZegoUIKitPrebuiltCallService.events.callEvents.addAudioOutputDeviceChangedListener(new ZegoAudioOutputDeviceChangedListener() {
@Override
public void onAudioOutputDeviceChanged(ZegoAudioOutputDevice audioOutput) {
}
});
onClick
The click event of the button corresponding to the enumeration class ZegoMenuBarButtonName
void onClick(ZegoMenuBarButtonName name, View view);
ZegoUIKitPrebuiltCallService.events.callEvents.setButtonClickListener(new ZegoMenuBarButtonClickListener() {
@Override
public void onClick(ZegoMenuBarButtonName name, View view) {
}
});
InvitationEvents
onIncomingCallDeclineButtonPressed
This callback will be triggered to callee when callee click decline button in incoming call
void onIncomingCallDeclineButtonPressed();
ZegoUIKitPrebuiltCallService.events.invitationEvents.setIncomingCallButtonListener(new IncomingCallButtonListener() {
@Override
public void onIncomingCallDeclineButtonPressed() {
//...
}
//...
});
onIncomingCallAcceptButtonPressed
This callback will be triggered to callee when callee click accept button in incoming call
void onIncomingCallAcceptButtonPressed();
ZegoUIKitPrebuiltCallService.events.invitationEvents.setIncomingCallButtonListener(new IncomingCallButtonListener() {
@Override
public void onIncomingCallAcceptButtonPressed() {
//...
}
//...
});
onOutgoingCallCancelButtonPressed
This callback will be triggered to caller when caller cancels the call invitation by click the cancel button
void onOutgoingCallCancelButtonPressed();
ZegoUIKitPrebuiltCallService.events.invitationEvents.setOutgoingCallButtonListener(new OutgoingCallButtonListener() {
@Override
public void onOutgoingCallCancelButtonPressed() {
//...
}
});
onIncomingCallReceived
This callback will be triggered to callee when callee receive a call
void onIncomingCallReceived(String callID, ZegoCallUser caller, ZegoCallType callType, List<ZegoCallUser> callees);
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
@Override
public void onIncomingCallReceived(String callID, ZegoCallUser caller, ZegoCallType callType,
List<ZegoCallUser> callees) {
//...
}
});
onIncomingCallCanceled
This callback will be triggered to callee when the caller cancels the call invitation.
public void onIncomingCallCanceled(String callID, ZegoCallUser caller)
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
@Override
public onIncomingCallCanceled(String callID, ZegoCallUser caller) {
//...
}
});
onIncomingCallTimeout
The callee will receive a notification through this callback when the callee doesn't respond to the call invitation after a timeout duration.
public void onIncomingCallTimeout(String callID, ZegoCallUser caller)
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
@Override
public onIncomingCallTimeout(String callID, ZegoCallUser caller) {
//...
}
});
onOutgoingCallAccepted
The caller will receive a notification through this callback when the callee accepts the call invitation.
public void onOutgoingCallAccepted(String callID, ZegoCallUser callee)
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
@Override
public onOutgoingCallAccepted(String callID, ZegoCallUser callee) {
//...
}
});
onOutgoingCallRejectedCauseBusy
The caller will receive a notification through this callback when the callee rejects the call invitation (the callee is busy).
public void onOutgoingCallRejectedCauseBusy(String callID, ZegoCallUser callee)
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
@Override
public onOutgoingCallRejectedCauseBusy(String callID, ZegoCallUser callee) {
//...
}
});
onOutgoingCallDeclined
The caller will receive a notification through this callback when the callee declines the call invitation actively.
public void onOutgoingCallDeclined(String callID, ZegoCallUser callee)
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
@Override
public onOutgoingCallDeclined(String callID, ZegoCallUser callee) {
//...
}
});
onOutgoingCallTimeout
The caller will receive a notification through this callback when the call invitation didn't get responses after a timeout duration.
public void onOutgoingCallTimeout(String callID, List<ZegoCallUser> callees)
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
@Override
public onOutgoingCallTimeout(String callID, List<ZegoCallUser> callees) {
//...
}
});
onError
This callback will be invoked when SDK error. For example, if SDK init error, INIT_PARAM_ERROR
will be throwed .
void onError(int errorCode, String message);
ZegoUIKitPrebuiltCallService.events.setErrorEventsListener(new ErrorEventsListener() {
@Override
public void onError(int errorCode, String message) {
}
});