WuKongIM Docs

Android API Reference

Find common WuKongIMAndroidSDK entry points, listeners, models, and states by manager.

This is a lookup page for common entry points, not a replacement for the task guides. The root singleton is WKIM.getInstance().

Initialization

APIPurpose
init(Context, uid, token)Initialize a user and open that UID's local database
setDebug(boolean)Control debug logging
setFileCacheDir(String)Set the file-cache directory
getMsgManager()Message manager
getConnectionManager()Connection manager
getConversationManager()Conversation manager
getChannelManager()Channel-profile manager
getChannelMembersManager()Group-member manager

ConnectionManager

APIPurpose
addOnGetIpAndPortListenerSupply a connection IP or hostname and port
connection()Start a connection attempt
disconnect(false)Stop connecting while retaining identity
disconnect(true)Sign out and clear the token
addOnConnectionStatusListener(key, listener)Observe connection state
removeOnConnectionStatusListener(key)Remove a state observer

States: fail, success, kicked, syncMsg, connecting, noNetwork, and syncCompleted.

MsgManager

APIPurpose
send(content, channel)Send content to a channel
sendWithOptions(content, channel, options)Send with advanced settings
sendMessage(WKMsg)Send or retry an existing message
addOnSendMsgCallbackObserve local message insertion
addOnSendMsgAckListenerObserve the server send result
addOnNewMsgListenerObserve new messages
addOnRefreshMsgListenerObserve message-object changes
getOrSyncHistoryMessagesRead local and, when needed, remote history
addOnSyncChannelMsgListenerConnect remote channel history
addOnUploadAttachListenerConnect media upload
registerContentMsgRegister custom content

Use the same key in the matching removal method, such as removeNewMsgListener, removeSendMsgAckListener, or removeRefreshMsgListener.

ConversationManager

APIPurpose
getAll(callback)Read the conversation list asynchronously
getWithChannelRead the conversation for one channel
updateRedDotSet a channel's unread count
deleteWitchChannelDelete a conversation row
addOnRefreshMsgListListenerObserve batches of conversation changes
addOnSyncConversationListenerConnect multi-device conversation sync

ChannelManager

APIPurpose
getChannelRead a local channel profile
fetchChannelInfoRequest a profile refresh
addOnGetChannelInfoListenerConnect user and group profile APIs
saveOrUpdateChannelStore a profile locally
addOnRefreshChannelInfoObserve profile changes

Common models

TypeMeaning
WKChannelchannelID, channelType, name, avatar, and settings
WKMsgMessage identity, content, sequence, and send state
WKMessageContentBase class for message content
WKTextContent / WKImageContentBuilt-in text and image content
WKUIConversationMsgChat-list row and unread count
WKChannelMemberGroup-member profile

Common channel types: WKChannelType.PERSONAL and WKChannelType.GROUP. Send states: WKSendMsgResult.send_loading, send_success, and send_fail.

On this page