Skip to content

Instantly share code, notes, and snippets.

@wajahatkarim3
Created January 31, 2021 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wajahatkarim3/d47de488cadcf0bdf03b1eacf602d4c5 to your computer and use it in GitHub Desktop.
Save wajahatkarim3/d47de488cadcf0bdf03b1eacf602d4c5 to your computer and use it in GitHub Desktop.
Signout functionality
bi.txtSignout.setOnClickListener {
CometChat.logout(object : CometChat.CallbackListener<String>() {
override fun onSuccess(p0: String?) {
val i = Intent(activity, MainActivity::class.java)
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(i)
activity?.finish()
}
override fun onError(ex: CometChatException?) {
Snackbar.make(bi.root, ex?.localizedMessage ?: "Couldn't logout CometChat user", Snackbar.LENGTH_SHORT).show()
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment