Handle Event for end all meeting from host

i register interface InMeetingServiceListener to listen event on meeting
there is no call for onMeetingLeaveComplete when host end meeting all
i want to listen on this event

SDK version v5.0.24437.0708

my code

registerLeaveEvent()
changeStateMeetingService(sessionOnline.MeetingId()!!)
StartMeetingHelper.getInstance()
.startMeetingWithNumber(
activity,
sessionOnline.MeetingId(),
sessionOnline.UserId(),
sessionOnline.ZAK(),
EduraApp.getUser()?.name
)

private fun registerLeaveEvent() {
    ZoomSDK.getInstance().inMeetingService.addListener(object : SimpleInMeetingListener() {
        override fun onMeetingLeaveComplete(l: Long) {
            if (l == MeetingEndReason.END_BY_HOST.toLong()) {
                Log.e("tag", "enddddddddddddddddddddddddddddd")
            }
        }
    })
}





private fun changeStateMeetingService(meetingId:String) {
    val meetingService = ZoomSDK.getInstance().meetingService
    if (meetingService.meetingStatus != MeetingStatus.MEETING_STATUS_IDLE) {
        var lMeetingNo: Long = 0
        lMeetingNo = try {
            meetingId.toLong()!!
        } catch (e: java.lang.NumberFormatException) {
            return
        }
        if (meetingService.currentRtcMeetingNumber == lMeetingNo) {
            meetingService.returnToMeeting(activity)
            return
        }
        AlertDialog.Builder(activity)
            .setMessage("Do you want to leave current meeting and start another?")
            .setPositiveButton(
                "Yes"
            ) { dialog, which ->
                mbPendingStartMeeting = true
                meetingService.leaveCurrentMeeting(false)
            }
            .setNegativeButton(
                "No"
            ) { dialog, which -> }
            .show()
        return
    }
}

Hi @eduraapp2020, thanks for using the devforum.

You should be seeing the onMeetingLeaveComplete callback invoked when you leave the meeting for any reason, including when the host ends the meeting. When the host ends the meeting, the param you get will be MeetingEndReason.END_BY_HOST if you are not the host.

If you are not seeing the log in your code snippet, it is possible that the reason for the meeting ending is different from that value. Can you modify your listener with the following code to assist with debugging and let me know what you’re seeing as the meeting end reason?

    ZoomSDK.getInstance().inMeetingService.addListener(object : SimpleInMeetingListener() {
        override fun onMeetingLeaveComplete(l: Long) {
            if (l == MeetingEndReason.END_BY_HOST.toLong()) {
                Log.e("tag", "enddddddddddddddddddddddddddddd")
            } else {
                Log.d("tag", "Meeting end reason: $l")
            }
        }
    })

Thanks!

thank you for replay , but i face problem listener for onMeetingLeaveComplete doesn’t call although i registered listener for InMeetingServiceListener

Hi @eduraapp2020, thanks for the additional info.

If you are not seeing the onMeetingLeaveMethod called at all, that means you are still in the meeting, have not added your listener to the InMeetingService instance, or your listener has been removed via InMeetingService.removeListener.

You can verify whether or not your listener is active by logging other callbacks within the listener. For example, you can add Log.d(TAG, "User audio changed") to the onUserAudioTypeChanged method, toggle a user’s audio, and check whether or not you see User audio changed in your logs to check if your listener is subscribed.

Thanks!

Hi @jon.zoom i want to do action when host end meeting for all can you help me for snippet for your code

Hi @eduraapp2020,

The code that you originally posted contains the correct way to respond to the host ending the meeting within the onMeetingLeaveComplete method. My previous posts have been an attempt at debugging why you are not seeing that method invoked.

Please follow the steps I previously laid out to verify what specifically within your implementation is not functioning properly and let me know what you’re seeing so that I can help. If anything from my previous responses is not clear, please let me know and I will be happy to clarify.

Thanks!