NCChat UI
NCChatUI — the main entry point for the ChatUI SDK.
Wraps nexconn-chat initialization and connection, provides a ChatUIFragmentFactory for all UI screens, and exposes an internal event bus for message and channel events.
- Call initialize once in onCreate.
- Call connect after a successful user login.
- Use getFragmentFactory (or setFragmentFactory) to launch any screen.
// 1. Initialize in Application.onCreate
NCChatUI.initialize(new InitParams(context, "your-app-key"));
// 2. Connect after login
NCChatUI.connect(new ConnectParams("user-token"), (userId, error) -> {
if (error == null) { // connected
}
});
// 3. Replace any screen with a custom Fragment
NCChatUI.setFragmentFactory(new MyCustomFragmentFactory());
Content copied to clipboard
See also
Chat UIFragment Factory
ai. nexconn. chat. NCEngine
Functions
Link copied to clipboard
Registers a cancel-send-media listener.
Link copied to clipboard
Registers a channel event listener.
Link copied to clipboard
Registers a message event listener.
Link copied to clipboard
Cancels an in-progress media message upload.
Link copied to clipboard
Creates the appropriate BaseChannel subtype for the given ChannelIdentifier.
Link copied to clipboard
public static void deleteLocalMessages(ChannelIdentifier identifier, List<Message> messages, ErrorHandler handler)
Deletes messages from the local database only, then dispatches a DeleteEvent so that the message list refreshes immediately.
Link copied to clipboard
public static void deleteMessageForAll(ChannelIdentifier identifier, Message message, OperationHandler<Message> handler)
Recalls (deletes for all participants) a message and dispatches a DeleteEvent to all registered MessageEventListeners.
Link copied to clipboard
public static void deleteMessages(ChannelIdentifier identifier, List<Message> messages, ErrorHandler handler)
Deletes messages for the current user (local + server-side for self) and dispatches a to all registered MessageEventListeners.
Link copied to clipboard
Disconnects from the server while keeping the push channel alive.
Link copied to clipboard
Returns the list of registered cancel-send-media listeners.
Link copied to clipboard
Returns the Application context saved during initialization.
Link copied to clipboard
Returns the current ChatUIFragmentFactory.
Link copied to clipboard
Returns the list of registered message event listeners.
Link copied to clipboard
Initializes the SDK.
Link copied to clipboard
public static void insertMessages(ChannelIdentifier identifier, List<InsertMessageItem> items, OperationHandler<Boolean> handler)
Inserts messages and dispatches an InsertEvent to all registered s.
Link copied to clipboard
Returns whether the SDK has been initialized.
Link copied to clipboard
Dispatches a message refresh event to all registered MessageEventListeners.
Link copied to clipboard
Unregisters a cancel-send-media listener.
Link copied to clipboard
Unregisters a previously registered channel event listener.
Link copied to clipboard
Unregisters a previously registered message event listener.
Link copied to clipboard
public static void sendMediaMessage(ChannelIdentifier identifier, SendMediaMessageParams params, SendMediaMessageHandler handler)
Sends a media message and dispatches send-lifecycle events to all registered s.
Link copied to clipboard
public static void sendMessage(ChannelIdentifier identifier, SendMessageParams params, SendMessageHandler handler)
Sends a text/binary message and dispatches send-lifecycle events to all registered s.
Link copied to clipboard
Replaces the current ChatUIFragmentFactory.
Link copied to clipboard
public static void syncConversationReadStatus(ChannelIdentifier channelIdentifier, long timestamp, ErrorHandler handler)
Syncs the read status of a channel to the server and notifies all registered s via onClearedUnreadStatus on success.