# Handle Event for end all meeting from host

**URL:** <https://devforum.zoom.us/t/handle-event-for-end-all-meeting-from-host/31753>\
**Category:** Android\
**Created:** [September 30, 2020, 8:33am UTC](https://devforum.zoom.us/t/handle-event-for-end-all-meeting-from-host/31753 "2020-09-30T08:33:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eduraapp2020](https://avatars.discourse-cdn.com/v4/letter/e/838e76/32.png) [@eduraapp2020](https://devforum.zoom.us/u/eduraapp2020)\
**Post date:** [September 30, 2020, 8:33am UTC](https://devforum.zoom.us/t/handle-event-for-end-all-meeting-from-host/31753/1 "2020-09-30T08:33:45Z")

</div>

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
    }
}
```

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [September 30, 2020, 5:46pm UTC](https://devforum.zoom.us/t/handle-event-for-end-all-meeting-from-host/31753/2 "2020-09-30T17:46:48Z")

</div>

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?

```auto
    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!

---

<div class="post-metadata">

**Author:** ![eduraapp2020](https://avatars.discourse-cdn.com/v4/letter/e/838e76/32.png) [@eduraapp2020](https://devforum.zoom.us/u/eduraapp2020)\
**Post date:** [October 2, 2020, 8:07pm UTC](https://devforum.zoom.us/t/handle-event-for-end-all-meeting-from-host/31753/3 "2020-10-02T20:07:16Z")

</div>

> [@jon.zoom](#):
>
> END\_BY\_HOST

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

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [October 2, 2020, 8:49pm UTC](https://devforum.zoom.us/t/handle-event-for-end-all-meeting-from-host/31753/4 "2020-10-02T20:49:29Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![eduraapp2020](https://avatars.discourse-cdn.com/v4/letter/e/838e76/32.png) [@eduraapp2020](https://devforum.zoom.us/u/eduraapp2020)\
**Post date:** [October 2, 2020, 9:14pm UTC](https://devforum.zoom.us/t/handle-event-for-end-all-meeting-from-host/31753/5 "2020-10-02T21:14:49Z")

</div>

> [@jon.zoom](#):
>
> listener

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

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [October 5, 2020, 6:33pm UTC](https://devforum.zoom.us/t/handle-event-for-end-all-meeting-from-host/31753/6 "2020-10-05T18:33:17Z")

</div>

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!
