Created
January 31, 2021 18:30
-
-
Save wajahatkarim3/d47de488cadcf0bdf03b1eacf602d4c5 to your computer and use it in GitHub Desktop.
Signout functionality
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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