val id = 0L; // Id of the message to be flagged
val flagDetail = FlagDetail()
flagDetail.reasonId = "spam" // Required: Reason ID for flagging the message
flagDetail.remark = "This message contains promotional content" // Optional: Additional remarks
CometChat.flagMessage(id, flagDetail, object : CometChat.CallbackListener<String?>() {
override fun onSuccess(s: String?) {
Log.i(TAG, "onSuccess: Message flagged successfully: $s")
}
override fun onError(e: CometChatException?) {
Log.i(TAG, "onError: Message flagging failed with error: ${e?.message}")
}
})