logo
On this page

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.

example
ZegoUIKitPrebuiltCallService.events.callEvents.setExpressEngineEventHandler(new IExpressEngineEventHandler() {
          
});
1
Copied!

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.

function prototype
example
boolean onBackPressed();
1
Copied!
ZegoUIKitPrebuiltCallService.events.callEvents.setBackPressEvent(new BackPressEvent() {
    @Override
    public boolean onBackPressed() {
        return false;
    }
 });
1
Copied!

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.

function prototype
example
void onOnlySelfInRoom();
1
Copied!
ZegoUIKitPrebuiltCallService.events.callEvents.setOnlySelfInRoomListener(new ZegoOnlySelfInRoomListener() {
    @Override
    public void onOnlySelfInRoom() {
        
    }
});
1
Copied!

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.

function prototype
example
void onCallEnd(ZegoCallEndReason callEndReason, String jsonObject) ;
1
Copied!
ZegoUIKitPrebuiltCallService.events.callEvents.setCallEndListener(new CallEndListener() {
    @Override
    public void onCallEnd(ZegoCallEndReason callEndReason, String jsonObject) {
        
    }
});
1
Copied!

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.

function
example
void onAudioOutputDeviceChanged(ZegoAudioOutputDevice audioOutput);
1
Copied!
ZegoUIKitPrebuiltCallService.events.callEvents.addAudioOutputDeviceChangedListener(new ZegoAudioOutputDeviceChangedListener() {
    @Override
    public void onAudioOutputDeviceChanged(ZegoAudioOutputDevice audioOutput) {
    }
});
1
Copied!

onClick

The click event of the button corresponding to the enumeration class ZegoMenuBarButtonName

function prototype
example
void onClick(ZegoMenuBarButtonName name, View view);
1
Copied!
ZegoUIKitPrebuiltCallService.events.callEvents.setButtonClickListener(new ZegoMenuBarButtonClickListener() {
    @Override
    public void onClick(ZegoMenuBarButtonName name, View view) {
        
    }
});
1
Copied!

InvitationEvents

onIncomingCallDeclineButtonPressed

This callback will be triggered to callee when callee click decline button in incoming call

function prototype
example
void onIncomingCallDeclineButtonPressed();
1
Copied!
ZegoUIKitPrebuiltCallService.events.invitationEvents.setIncomingCallButtonListener(new IncomingCallButtonListener() {
    @Override
    public void onIncomingCallDeclineButtonPressed() {
        //...
    }
    //...
});
1
Copied!

onIncomingCallAcceptButtonPressed

This callback will be triggered to callee when callee click accept button in incoming call

function prototype
example
void onIncomingCallAcceptButtonPressed();
1
Copied!
ZegoUIKitPrebuiltCallService.events.invitationEvents.setIncomingCallButtonListener(new IncomingCallButtonListener() {
    @Override
    public void onIncomingCallAcceptButtonPressed() {
        //...  
    }
    //...
});
1
Copied!

onOutgoingCallCancelButtonPressed

This callback will be triggered to caller when caller cancels the call invitation by click the cancel button

function prototype
example
void onOutgoingCallCancelButtonPressed();
1
Copied!
ZegoUIKitPrebuiltCallService.events.invitationEvents.setOutgoingCallButtonListener(new OutgoingCallButtonListener() {
    @Override
    public void onOutgoingCallCancelButtonPressed() {
        //...
    }
});
1
Copied!

onIncomingCallReceived

This callback will be triggered to callee when callee receive a call

function prototype
example
void onIncomingCallReceived(String callID, ZegoCallUser caller, ZegoCallType callType, List<ZegoCallUser> callees);
1
Copied!
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
    @Override
    public void onIncomingCallReceived(String callID, ZegoCallUser caller, ZegoCallType callType,
        List<ZegoCallUser> callees) {
        //...
    }
});
1
Copied!

onIncomingCallCanceled

This callback will be triggered to callee when the caller cancels the call invitation.

function prototype
example
public void onIncomingCallCanceled(String callID, ZegoCallUser caller) 
1
Copied!
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
    @Override
    public onIncomingCallCanceled(String callID, ZegoCallUser caller)  {
        //...
    }
 });
1
Copied!

onIncomingCallTimeout

The callee will receive a notification through this callback when the callee doesn't respond to the call invitation after a timeout duration.

function prototype
example
public void onIncomingCallTimeout(String callID, ZegoCallUser caller)
1
Copied!
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
    @Override
    public onIncomingCallTimeout(String callID, ZegoCallUser caller)  {
        //...
    }
 });
1
Copied!

onOutgoingCallAccepted

The caller will receive a notification through this callback when the callee accepts the call invitation.

function prototype
example
public void onOutgoingCallAccepted(String callID, ZegoCallUser callee)
1
Copied!
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
    @Override
    public onOutgoingCallAccepted(String callID, ZegoCallUser callee)  {
        //...
    }
 });
1
Copied!

onOutgoingCallRejectedCauseBusy

The caller will receive a notification through this callback when the callee rejects the call invitation (the callee is busy).

function prototype
example
public void onOutgoingCallRejectedCauseBusy(String callID, ZegoCallUser callee)
1
Copied!
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
    @Override
    public onOutgoingCallRejectedCauseBusy(String callID, ZegoCallUser callee)  {
        //...
    }
});
1
Copied!

onOutgoingCallDeclined

The caller will receive a notification through this callback when the callee declines the call invitation actively.

function prototype
example
public void onOutgoingCallDeclined(String callID, ZegoCallUser callee) 
1
Copied!
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
    @Override
    public onOutgoingCallDeclined(String callID, ZegoCallUser callee)  {
        //...
    }
});
1
Copied!

onOutgoingCallTimeout

The caller will receive a notification through this callback when the call invitation didn't get responses after a timeout duration.

function prototype
example
public void onOutgoingCallTimeout(String callID, List<ZegoCallUser> callees) 
1
Copied!
ZegoUIKitPrebuiltCallService.events.invitationEvents.setInvitationListener(new ZegoInvitationCallListener() {
    @Override
    public onOutgoingCallTimeout(String callID, List<ZegoCallUser> callees)  {
        //...
    }
 });
1
Copied!

onError

This callback will be invoked when SDK error. For example, if SDK init error, INIT_PARAM_ERROR will be throwed .

function prototype
example
void onError(int errorCode, String message);
1
Copied!
ZegoUIKitPrebuiltCallService.events.setErrorEventsListener(new ErrorEventsListener() {
    @Override
    public void onError(int errorCode, String message) {

    }
});
1
Copied!