Skip to content

NinchatSDKEventListener

Pallab Gain edited this page Mar 26, 2024 · 2 revisions

Using NinchatSDKEventListener, we can listen to SDK events. It is useful when you want to update your UI based on Ninchat SDK events like when a ninchat session successfully established, failed or some other relivant error(s) occured.

private val eventListener: NinchatSDKEventListener = object : NinchatSDKEventListener() {
        override fun onSessionInitiated(sessionCredentials: NinchatSessionCredentials) {
            Log.d(">>", sessionCredentials.toString())
        }

        override fun onSessionInitFailed() {
            Log.d(">>", "session failed")
        }

        override fun onSessionError(error: Exception) {
            Log.d(">>", error.localizedMessage)
        }

        override fun onEvent(params: Props, payload: Payload) {
            Log.d("On Event >>", params.toString())
        }

        // From SDK 0.17.1
        override fun onActivityDropped() {
            Log.e(">>", "activity dropped")
        }
    }
Clone this wiki locally