Browse SDKs · Android
Platform
SDKsAndroidEnterprise

Set burn-after-reading duration

Configure the destruction countdown interval (in seconds) for burn-after-reading messages in a conversation.

Copy

Configure the reading countdown interval (in seconds) for a conversation operating in burn-after-reading mode. Once burn-after-reading is active, messages trigger this destruction timer as soon as the recipient opens them.

Code example

OpenIMClient.getInstance().conversationManager.setConversationBurnDuration(
    new OnBase<String>() {
        @Override
        public void onSuccess(String data) {
            // Burn duration updated.
        }

        @Override
        public void onError(int code, String error) {
            // code and error describe the failure.
        }
    },
    conversationID,
    30
);

Parameters

ParameterTypeRequiredDescription
baseOnBase<String>YesCallback delivering the asynchronous operation result.
conversationIDStringYesTarget conversation identifier.
burnDurationintYesCountdown duration in seconds, such as 30. Do not confuse with scheduled server-side message deletion.

Return value

The successful callback indicates that the server persisted the burn duration setting. To activate or deactivate burn-after-reading mode itself, call Enable or disable burn after reading.

State changes after the call

Once the duration takes effect, the SDK triggers the OnConversationListener.onConversationChanged event. Locate the conversation by conversationID and update its burnDuration property. For complete listener registration details, see Get the conversation list.