Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use the setSendMessageListener method to intercept or monitor all sent messages

Shulou Source: shulou.com Published: 2022-05-31 10:57:45 10月03日 Update

This article introduces the knowledge of "how to use setSendMessageListener to intercept or monitor all sent messages". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The specific method is the setSendMessageListener method under the RongIM class.

The code is as follows.

/ * sets the listening for sending messages. * * @ param listener listens to send messages. * / RongIM.setSendMessageListener (new OnSendMessageListener () {@ Override public Message onSend (Message message) {/ / use this method before sending a message. Message is the message to be sent. / / if null is returned, the message will not be sent. Return message;} @ Override public boolean onSent (Message message, SentMessageErrorCode sentMessageErrorCode) {the method will be used after it is successfully sent. If you return true, you will follow the logic of SDK. Intercept it when you return to false. Return true;}}). This is the end of the content of "how to intercept or monitor all sent messages using the setSendMessageListener method". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: News method monitoring content more knowledge practicality success learning next code dilemma reality situation article case this method editing website industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux NVidia macOS MySQL Microsoft