CustomMediaMessageContent

public abstract class CustomMediaMessageContent extends MediaMessageContent

Custom Media Message content base class.

Business party Inherits This class from Define Custom Media Message class type (need File Upload message, e.g. Custom Image, Custom File etc.). SDK internal Responsible for Register, Send (Including Upload) and Receive Decode, no need to access internal SDK any Type.

and CustomMessageContent difference:

  • Inherits from MediaMessageContent, automatically Contains localUri, remoteUri, name etc. Media Property

  • internal Send When go Media Upload channel/path, SDK automatically Handle File Upload

Subclass need:

  1. Provides no-argument Constructor (SDK Via reflection Create instance)

  2. Implements messageType, persistentFlag, encodeFields, decodeFields

Usage Example:

class CustomFileMessage : CustomMediaMessageContent() {
var fileType: String = ""
var fileSize: Long = 0L

override fun messageType(): String = "app:customfile"

override fun persistentFlag(): Int = MessageFlag.COUNT

override fun encodeFields(): Map<String, Any?> = mapOf(
"fileType" to fileType,
"fileSize" to fileSize
)

override fun decodeFields(fields: Map<String, Any?>) {
fileType = fields["fileType"] as? String ?: ""
fileSize = (fields["fileSize"] as? Number)?.toLong() ?: 0L
}
}

NCEngine.registerCustomMessages(listOf(CustomFileMessage::class.java))
NCEngine.registerCustomMessages(listOf(CustomFileMessage::class.java))

Message type identifier.

Constructors

Inherited properties

Link copied to clipboard
private Long destructTime

after reading i.e. burn-after-reading destroy When time (Unit: seconds), message Read after passing This When destroy after time

Link copied to clipboard
private String extra

Message content extra data (follow message Send, Sync Remote)

Link copied to clipboard
private Boolean isDestruct

Whether after reading i.e. burn message

Link copied to clipboard
private String localUri

Media Content Local Path

Link copied to clipboard

@ mention Info

Link copied to clipboard
private String name

Media Content File name

Link copied to clipboard
private String remoteUri

Media Content Upload Server after Remote URL

Functions

Link copied to clipboard
public abstract Unit decodeFields(Map<String, Object> fields)

Receive message When Call. Note: localUri and remoteUri By SDK auto-restore,

Link copied to clipboard
public abstract Map<String, Object> encodeFields()

Send message When Call. Note: localUri and remoteUri By SDK automatically Handle,

Link copied to clipboard
public abstract String messageType()

Not can by "RC:" prefix ("RC:" official reserved prefix).

Link copied to clipboard
public abstract Integer persistentFlag()

See MessageFlag Constants:

Link copied to clipboard
public List<String> searchableWords()

Used for Message search Feature, Returns need Was/were indexed keyword.

Inherited functions

Link copied to clipboard
public final Long getDestructTime()

after reading i.e. burn-after-reading destroy When time (Unit: seconds), message Read after passing This When destroy after time

Link copied to clipboard
public final String getExtra()

Message content extra data (follow message Send, Sync Remote)

Link copied to clipboard
public final String getLocalUri()

Media Content Local Path

Link copied to clipboard

@ mention Info

Link copied to clipboard
public final String getName()

Media Content File name

Link copied to clipboard
public final String getRemoteUri()

Media Content Upload Server after Remote URL

Link copied to clipboard
public final Boolean isDestruct()

Whether after reading i.e. burn message

Link copied to clipboard
public final Unit setDestruct(Boolean isDestruct)

Whether after reading i.e. burn message

Link copied to clipboard
public final Unit setDestructTime(Long destructTime)

after reading i.e. burn-after-reading destroy When time (Unit: seconds), message Read after passing This When destroy after time

Link copied to clipboard
public final Unit setExtra(String extra)

Message content extra data (follow message Send, Sync Remote)

Link copied to clipboard
public final Unit setLocalUri(String localUri)

Media Content Local Path

Link copied to clipboard
public final Unit setMentionedInfo(MentionedInfo mentionedInfo)

@ mention Info

Link copied to clipboard
public final Unit setName(String name)

Media Content File name

Link copied to clipboard
public final Unit setRemoteUri(String remoteUri)

Media Content Upload Server after Remote URL

Link copied to clipboard
public String toString()