Class CometChat


  • public final class CometChat
    extends java.lang.Object
    The class that the CometChat Pro Android SDK exposes to the developers to perform most of the operations.
    • Method Detail

      • getConnectionStatus

        public static java.lang.String getConnectionStatus()
      • init

        public static void init​(Context appContext,
                                java.lang.String appID,
                                AppSettings globalAppSettings,
                                CometChat.CallbackListener<java.lang.String> listener)
        This method is used to initialize the SDK with the various parameters required for the SDK to function as expected. No other methods can be called unless the init() method is called.
        Parameters:
        appContext - - An object of the @see android.content.Context Context class that provides the SDK with the context of the application in which the SDK is being integrated.
        appID - - App ID of the CometChat App created. This can be found at the CometChat Dashboard {@link "https://app.cometchat.io"}
        globalAppSettings - - An object of the @see com.cometchat.pro.core.AppSettings AppSettings class, that holds basic settings related to the SDK.
        listener - - An object of the CallbackListener<String> class that helps inform the developer if the operation was successful or any error occurred.
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • isInitialized

        public static boolean isInitialized()
        This method is used to check if the SDK has been initialized.
      • login

        public static void login​(java.lang.String uid,
                                 java.lang.String apiKey,
                                 CometChat.CallbackListener<User> listener)
        This method is used to login in CometChat SDK. Developer can only call other CometChat methods after authentication with this method.
        Parameters:
        uid - Unique identifier of the user
        apiKey - API_KEY of the CometChat App created. This can be found at the CometChat Dashboard {@link "https://app.cometchat.io"}.
        listener - An object of the CallbackListener<User> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener, login(java.lang.String, com.cometchat.pro.core.CometChat.CallbackListener)
      • login

        public static void login​(java.lang.String authToken,
                                 CometChat.CallbackListener<User> listener)
        This method is used to login in CometChat SDK. Developer can only call other CometChat methods after authentication with this method.
        Parameters:
        authToken - AuthToken can be generated using API_KEY of the CometChat App created. Developer can also use authOnly API_KEY. This can be found at the CometChat Dashboard {@link "https://app.cometchat.io"}.
        listener - An object of the CallbackListener<User> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener, User
      • connect

        public static void connect()
        Establishes a connection to the web-socket server for the logged in user
        Since:
        v3
      • disconnect

        public static void disconnect()
        Destroys the connection to the web-socket server for the logged in user
        Since:
        v3
      • getUser

        public static void getUser​(java.lang.String UID,
                                   CometChat.CallbackListener<User> listener)
        Get the information for a user
        Parameters:
        UID - Unique identifier of the user
        listener - An object of the CallbackListener<User> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener, User
      • sendMessage

        public static void sendMessage​(TextMessage message,
                                       CometChat.CallbackListener<TextMessage> listener)
        This method is used for sending text message to a particular user or group with mentioned parameters
        Parameters:
        message - An object of the TextMessage class with the required details about the receiverUid, text be to sent and receiverType . TextMessage(@NonNull String receiverUid, @NonNull String text, @CometChatConstants.ReceiverTypes String receiverType)
        listener - An object of the CallbackListener<TextMessage> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        TextMessage, CometChatConstants.ReceiverTypes, CometChatConstants, CometChat.CallbackListener
      • sendMediaMessage

        public static void sendMediaMessage​(MediaMessage message,
                                            CometChat.CallbackListener<MediaMessage> listener)
        This method is used for sending media message to a particular user or group with mentioned parameters
        Parameters:
        message - An object of the MediaMessage class with the required details about the receiverUid, file to be sent,messageType and receiverType . MediaMessage(String receiverUid, File file, @CometChatConstants.MessageTypes String messageType, @CometChatConstants.ReceiverTypes String receiverType)
        listener - An object of the CallbackListener<MediaMessage> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        MediaMessage, CometChatConstants.MessageTypes, CometChatConstants.ReceiverTypes, CometChatConstants, CometChat.CallbackListener
      • sendCustomMessage

        public static void sendCustomMessage​(CustomMessage customMessage,
                                             CometChat.CallbackListener<CustomMessage> listener)
        This method is used for sending custom message to a particular user or group with mentioned parameters. This method is made for developers to make their own custom messages as per requirement
        Parameters:
        customMessage - An object of the CustomMessage class with the required details about the receiverUid, receiverType,customType of the message and JSONObject of the custom data . CustomMessage(String receiverUid, @CometChatConstants.ReceiverTypes String receiverType, String customType, @NonNull JSONObject customData )
        listener - An object of the CallbackListener<CustomMessage> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CustomMessage, CometChatConstants, CometChatConstants.ReceiverTypes, CometChat.CallbackListener
      • createGroup

        public static void createGroup​(Group group,
                                       CometChat.CallbackListener<Group> listener)
        createGroup() method is used for creating groups of different types such as public,password and private group
        Parameters:
        group - An object of the Group class with the required details about the guid, name,groupType,password,icon and description based on the constructor Group(String guid, String name, @CometChatConstants.GroupTypes String groupType, String password) Group(String guid, String name, @CometChatConstants.GroupTypes String groupType, String password, String icon, String description)
        listener - An object of the CallbackListener<Group> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        Group, CometChatConstants.GroupTypes, CometChatConstants, CometChat.CallbackListener
      • joinGroup

        public static void joinGroup​(java.lang.String guid,
                                     java.lang.String groupType,
                                     java.lang.String password,
                                     CometChat.CallbackListener<Group> listener)
        joinGroup() method is used to join groups of different types such as public and password group
        Parameters:
        guid - Unique identifier of a Group
        groupType - Type of the Group user wants to join
        password - password of the group if the group type is CometChatConstants.GROUP_TYPE_PASSWORD else the field can be left null or empty
        listener - An object of the CallbackListener<Group> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChatConstants.GroupTypes, CometChatConstants, Group, CometChat.CallbackListener
      • leaveGroup

        public static void leaveGroup​(java.lang.String guid,
                                      CometChat.CallbackListener<java.lang.String> listener)
        This method is used for leaving a particular group.The method requires guid and an object of CallbackListener class
        Parameters:
        guid - Unique identifier of a Group
        listener - An object of the CallbackListener<String> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • updateGroup

        public static void updateGroup​(Group group,
                                       CometChat.CallbackListener<Group> listener)
        This method is used for updating the group information such as name,description,icon,password,type etc.
        Parameters:
        group - An object of the Group class with the required details about the guid, name,groupType,password,icon and description based on the constructor Group(String guid, String name, @CometChatConstants.GroupTypes String groupType, String password) Group(String guid, String name, @CometChatConstants.GroupTypes String groupType, String password, String icon, String description)
        listener - An object of the CallbackListener<Group> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        Group, CometChatConstants.GroupTypes, CometChatConstants, CometChat.CallbackListener
      • deleteGroup

        public static void deleteGroup​(java.lang.String guid,
                                       CometChat.CallbackListener<java.lang.String> listener)
        deleteGroup() is called for deleting a particular group.The method requires guid and an object of CallbackListener class
        Parameters:
        guid - Unique identifier of a Group
        listener - An object of the CallbackListener<String> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • getGroup

        public static void getGroup​(java.lang.String guid,
                                    CometChat.CallbackListener<Group> listener)
        Get information about a group
        Parameters:
        guid - Unique identifier of the Group
        listener - An object of the CallbackListener<Group> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener, User, Group
      • kickGroupMember

        public static void kickGroupMember​(java.lang.String uid,
                                           java.lang.String guid,
                                           CometChat.CallbackListener<java.lang.String> listener)
        Method to kick a member from a Group
        Parameters:
        uid - Unique identifier of a User
        guid - Unique identifier of a Group
        listener - An object of the CallbackListener<String> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • banGroupMember

        public static void banGroupMember​(java.lang.String uid,
                                          java.lang.String guid,
                                          CometChat.CallbackListener<java.lang.String> listener)
        Method to ban a member from a Group
        Parameters:
        uid - Unique identifier of a User
        guid - Unique identifier of a Group
        listener - An object of the CallbackListener<String> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • unbanGroupMember

        public static void unbanGroupMember​(java.lang.String uid,
                                            java.lang.String guid,
                                            CometChat.CallbackListener<java.lang.String> listener)
        Method to unban a member from a Group
        Parameters:
        uid - Unique identifier of a User
        guid - Unique identifier of a Group
        listener - An object of the CallbackListener<String> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • updateGroupMemberScope

        public static void updateGroupMemberScope​(java.lang.String uid,
                                                  java.lang.String guid,
                                                  java.lang.String scope,
                                                  CometChat.CallbackListener<java.lang.String> listener)
        Method to update scope a member in a Group
        Parameters:
        uid - Unique identifier of a User
        guid - Unique identifier of a Group
        scope - Scope to be assigned to the user
        listener - An object of the CallbackListener<String> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener, CometChatConstants.MemberScope
      • transferGroupOwnership

        public static void transferGroupOwnership​(java.lang.String GUID,
                                                  java.lang.String UID,
                                                  CometChat.CallbackListener<java.lang.String> listener)
        Method to transfer the group ownership to a different group member
        Parameters:
        GUID - Unique identifier of the group
        UID - Unique identifier of the user
        listener - An object of the CallbackListener<String> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener, CometChatConstants.MemberScope
      • startTyping

        public static void startTyping​(TypingIndicator typingIndicator)
        Sends the typing start indicator to user or group
        Parameters:
        typingIndicator - An object of TypingIndicator class which requires receiverId and receiverType. TypingIndicator(@NonNull String receiverId, @CometChatConstants.ReceiverTypes String receiverType) TypingIndicator(@NonNull String receiverId, @CometChatConstants.ReceiverTypes String receiverType, @NonNull JSONObject metadata)
        See Also:
        CometChatConstants.ReceiverTypes, TypingIndicator
      • endTyping

        public static void endTyping​(TypingIndicator typingIndicator)
        Sends the end typing indicator to user or group
        Parameters:
        typingIndicator - An object of TypingIndicator class which requires receiverId and receiverType. TypingIndicator(@NonNull String receiverId, @CometChatConstants.ReceiverTypes String receiverType) TypingIndicator(@NonNull String receiverId, @CometChatConstants.ReceiverTypes String receiverType, @NonNull JSONObject metadata)
        Since:
        v1
        See Also:
        CometChatConstants.ReceiverTypes, TypingIndicator
      • markAsRead

        @Deprecated
        public static void markAsRead​(int messageId,
                                      java.lang.String receiverId,
                                      java.lang.String receiverType)
        Deprecated.
        This method marks the message with the provided Id and all the messages prior to that message as read for that for that particular conversation
        Parameters:
        messageId - Unique Id of the message to be marked
        receiverId - Id of the receiver whose message to be marked
        receiverType - Type of the receiver whether user or group
        Since:
        v1
        See Also:
        CometChatConstants.ReceiverTypes
      • markAsRead

        public static void markAsRead​(int messageId,
                                      java.lang.String receiverId,
                                      java.lang.String receiverType,
                                      java.lang.String messageSender,
                                      CometChat.CallbackListener<java.lang.Void> listener)
        This method marks the message with the provided Id and all the messages prior to that message as read for that for that particular conversation
        Parameters:
        messageId - Unique Id of the message to be marked
        receiverId - Id of the receiver whose message to be marked
        receiverType - Type of the receiver whether user or group
        messageSender - The UID of the sender of the message.
        listener - An object of the CallbackListener<Void> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v3
        See Also:
        CometChatConstants.ReceiverTypes
      • markAsRead

        public static void markAsRead​(int messageId,
                                      java.lang.String receiverId,
                                      java.lang.String receiverType,
                                      java.lang.String messageSender)
        This method marks the message with the provided Id and all the messages prior to that message as read for that for that particular conversation
        Parameters:
        messageId - Unique Id of the message to be marked
        receiverId - Id of the receiver whose message to be marked
        receiverType - Type of the receiver whether user or group
        messageSender - The UID of the sender of the message.
        Since:
        v3
        See Also:
        CometChatConstants.ReceiverTypes
      • markAsRead

        public static void markAsRead​(BaseMessage message,
                                      CometChat.CallbackListener<java.lang.Void> listener)
        This method marks the message provided and all the messages prior to that message as read for that particular conversation
        Parameters:
        message - An object of the BaseMessage class which requires receiverUid,type and receiverType BaseMessage(String receiverUid, String type, @CometChatConstants.ReceiverTypes String receiverType)
        listener - An object of the CallbackListener<Void> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v3
        See Also:
        CometChatConstants.ReceiverTypes
      • markAsRead

        public static void markAsRead​(BaseMessage message)
        This method marks the message provided and all the messages prior to that message as read for that particular conversation
        Parameters:
        message - An object of the BaseMessage class which requires receiverUid,type and receiverType BaseMessage(String receiverUid, String type, @CometChatConstants.ReceiverTypes String receiverType)
        Since:
        v3
        See Also:
        CometChatConstants.ReceiverTypes
      • markAsDelivered

        @Deprecated
        public static void markAsDelivered​(int messageId,
                                           java.lang.String receiverId,
                                           java.lang.String receiverType)
        Deprecated.
        Marks message as Delivered
        Parameters:
        messageId - Unique Id of the message to be marked
        receiverId - Id of the receiver whose message to be marked
        receiverType - Type of the receiver whether user or group
        Since:
        v1
        See Also:
        CometChatConstants.ReceiverTypes
      • markAsDelivered

        public static void markAsDelivered​(int messageId,
                                           java.lang.String receiverId,
                                           java.lang.String receiverType,
                                           java.lang.String messageSender,
                                           CometChat.CallbackListener<java.lang.Void> listener)
        This method marks the message with the provided Id and all the messages prior to that message as delivered for that particular conversation
        Parameters:
        messageId - Unique Id of the message to be marked
        receiverId - Id of the receiver whose message to be marked
        receiverType - Type of the receiver whether user or group
        messageSender - The UID of the sender of the message.
        listener - An object of the CallbackListener<Void> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v3
        See Also:
        CometChatConstants.ReceiverTypes
      • markAsDelivered

        public static void markAsDelivered​(int messageId,
                                           java.lang.String receiverId,
                                           java.lang.String receiverType,
                                           java.lang.String messageSender)
        This method marks the message with the provided Id and all the messages prior to that message as delivered for that particular conversation
        Parameters:
        messageId - Unique Id of the message to be marked
        receiverId - Id of the receiver whose message to be marked
        receiverType - Type of the receiver whether user or group
        messageSender - The UID of the sender of the message.
        Since:
        v3
        See Also:
        CometChatConstants.ReceiverTypes
      • markAsDelivered

        public static void markAsDelivered​(BaseMessage message,
                                           CometChat.CallbackListener<java.lang.Void> listener)
        This method marks the message provided and all the messages prior to that message as delivered for that particular conversation
        Parameters:
        message - An object of the BaseMessage class which requires receiverUid,type and receiverType BaseMessage(String receiverUid, String type, @CometChatConstants.ReceiverTypes String receiverType)
        listener - An object of the CallbackListener<Void> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v3
        See Also:
        CometChatConstants.ReceiverTypes
      • markAsDelivered

        public static void markAsDelivered​(BaseMessage message)
        This method marks the message provided and all the messages prior to that message as delivered for that particular conversation
        Parameters:
        message - An object of the BaseMessage class which requires receiverUid,type and receiverType BaseMessage(String receiverUid, String type, @CometChatConstants.ReceiverTypes String receiverType)
        Since:
        v3
        See Also:
        CometChatConstants.ReceiverTypes
      • logout

        public static void logout​(CometChat.CallbackListener<java.lang.String> listener)
        Method to logout from CometChat SDK
        Parameters:
        listener - An object of the CallbackListener<String> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • initiateCall

        public static void initiateCall​(Call call,
                                        CometChat.CallbackListener<Call> listener)
        A method to initiate call between between two Users or a particular Group
        Parameters:
        call - An object of the Call class which requires receiverId,receiverType and callType to work as expected
        listener - An object of the CallbackListener<Call> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        Call, CometChatConstants.ReceiverTypes, CometChatConstants.CallType, CometChat.CallbackListener
      • rejectCall

        public static void rejectCall​(java.lang.String sessionId,
                                      java.lang.String status,
                                      CometChat.CallbackListener<Call> listener)
        A method to reject call between between two Users or a particular Group
        Parameters:
        sessionId - The Unique sessionId of the call be to rejected
        status - Status to be sent while rejecting a call CometChatConstants.CALL_STATUS_REJECTED CometChatConstants.CALL_STATUS_CANCELLED CometChatConstants.CALL_STATUS_BUSY
        listener - An object of the CallbackListener<Call> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChatConstants.CallType, Call, CometChat.CallbackListener
      • acceptCall

        public static void acceptCall​(java.lang.String sessionId,
                                      CometChat.CallbackListener<Call> listener)
        A method to accept call between between two Users or a particular Group
        Parameters:
        sessionId - The Unique sessionId of the call be to rejected
        listener - An object of the CallbackListener<Call> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        Call, CometChat.CallbackListener
      • endCall

        public static void endCall​(java.lang.String sessionId,
                                   CometChat.CallbackListener<Call> listener)
        A method to end call between between two Users or a particular Group
        Parameters:
        sessionId - The Unique sessionId of the call be to ended
        listener - An object of the CallbackListener<Call> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        Call, CometChat.CallbackListener
      • startCall

        public static void startCall​(Activity activity,
                                     java.lang.String sessionId,
                                     RelativeLayout relativeLayout,
                                     CometChat.OngoingCallListener listener)
        A method to start call between between two Users or a particular Group
        Parameters:
        activity - Activity reference where you want to show the call view
        sessionId - The Unique sessionId of the call be to rejected
        relativeLayout - An object of the relativeLayout class in which CometChat can load the calling views
        listener - An object of the OngoingCallListener class that helps inform the developer about the ongoing call events like onYouJoined(), onYouLeft(),onUserJoined(),onUserDisconnected(),onCallEnded() and onError()
        Since:
        v1
        See Also:
        CallManager.CallListener
      • startCall

        public static void startCall​(CallSettings settings,
                                     CometChat.OngoingCallListener listener)
        A method to start call between between two Users or a particular Group
        Parameters:
        settings - An object of the CallSettings class, that provides the settings for the call to be started
        listener - An object of the OngoingCallListener class that helps inform the developer about the ongoing call events like onYouJoined(), onYouLeft(),onUserJoined(),onUserDisconnected(),onCallEnded() and onError()
        Since:
        v1
        See Also:
        CallManager.CallListener
      • getActiveCall

        public static Call getActiveCall()
        Returns Call object of Active call
        Returns:
        Call Object of the currently Active Call
        Since:
        v2
        See Also:
        Call
      • getLastDeliveredMessageId

        public static int getLastDeliveredMessageId()
        Return last Delivered Message Id
        Returns:
        id of message
        Since:
        v1
      • addExtension

        public static void addExtension​(com.cometchat.pro.core.CometChatExtension cometChatExtension)
      • isExtensionEnabled

        public static boolean isExtensionEnabled​(java.lang.String extensionId)
      • blockUsers

        public static void blockUsers​(java.util.List<java.lang.String> uids,
                                      CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.lang.String>> listener)
        Method to block users
        Parameters:
        uids - List of UID to be blocked
        listener - An object of the CallbackListener<HashMap<String,String>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • unblockUsers

        public static void unblockUsers​(java.util.List<java.lang.String> uids,
                                        CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.lang.String>> listener)
        Method to unblock users
        Parameters:
        uids - List of UID to be blocked
        listener - An object of the CallbackListener<HashMap<String,String>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • getMessageReceipts

        public static void getMessageReceipts​(int messageId,
                                              CometChat.CallbackListener<java.util.List<MessageReceipt>> listener)
        This method get information about the delivery and read receipts of a particular message
        Parameters:
        messageId - Unique id of the message
        listener - An object of the CallbackListener<List<MessageReceipt>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener, MessageReceipt
      • getMessageDetails

        public static void getMessageDetails​(int messageId,
                                             CometChat.CallbackListener<BaseMessage> listener)
        This method get information of a single message based on the ID provided
        Parameters:
        messageId - Unique id of the message
        listener - An object of the CallbackListener<List<MessageReceipt>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v3
        See Also:
        CometChat.CallbackListener
      • getUnreadMessageCountForUser

        public static void getUnreadMessageCountForUser​(java.lang.String UID,
                                                        CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.lang.Integer>> listener)
        Gets unread count of messages for a particular User
        Parameters:
        UID - Unique identifier of a User
        listener - An object of the CallbackListener<HashMap<String,Integer>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • getUnreadMessageCountForUser

        public static void getUnreadMessageCountForUser​(java.lang.String UID,
                                                        boolean hideMessagesFromBlockedUsers,
                                                        CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.lang.Integer>> listener)
        Gets unread count of messages for a particular User
        Parameters:
        UID - Unique identifier of a User
        hideMessagesFromBlockedUsers - boolean parameter to show or hide messages count of the blocked user
        listener - An object of the CallbackListener<HashMap<String,Integer>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • getUnreadMessageCountForGroup

        public static void getUnreadMessageCountForGroup​(java.lang.String GUID,
                                                         CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.lang.Integer>> listener)
        Gets unread count of messages for a particular Group
        Parameters:
        GUID - Unique identifier of a Group
        listener - An object of the CallbackListener<HashMap<String,Integer>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • getUnreadMessageCountForGroup

        public static void getUnreadMessageCountForGroup​(java.lang.String GUID,
                                                         boolean hideMessagesFromBlockedUsers,
                                                         CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.lang.Integer>> listener)
        Gets unread count of messages for a particular Group
        Parameters:
        GUID - Unique identifier of a Group
        hideMessagesFromBlockedUsers - boolean parameter to show or hide messages count of the blocked user
        listener - An object of the CallbackListener<HashMap<String,Integer>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • getUnreadMessageCount

        public static void getUnreadMessageCount​(CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.util.HashMap<java.lang.String,​java.lang.Integer>>> listener)
        Gets total unread count of messages for all users and all groups
        Parameters:
        listener - An object of the CallbackListener<HashMap<String,HashMap<String,Integer>>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • getUnreadMessageCount

        public static void getUnreadMessageCount​(boolean hideMessagesFromBlockedUsers,
                                                 CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.util.HashMap<java.lang.String,​java.lang.Integer>>> listener)
        Gets unread count of messages for all users and all groups
        Parameters:
        hideMessagesFromBlockedUsers - boolean parameter to show or hide messages count of the blocked user
        listener - An object of the CallbackListener<HashMap<String,HashMap<String,Integer>>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • getUnreadMessageCountForAllUsers

        public static void getUnreadMessageCountForAllUsers​(CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.lang.Integer>> listener)
        Gets total unread count of messages for all Users
        Parameters:
        listener - An object of the CallbackListener<HashMap<String,Integer>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • getUnreadMessageCountForAllUsers

        public static void getUnreadMessageCountForAllUsers​(boolean hideMessagesFromBlockedUsers,
                                                            CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.lang.Integer>> listener)
        Gets total unread count of messages for all Users
        Parameters:
        hideMessagesFromBlockedUsers - boolean parameter to show or hide messages count of the blocked user
        listener - An object of the CallbackListener<HashMap<String,Integer>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • getUnreadMessageCountForAllGroups

        public static void getUnreadMessageCountForAllGroups​(CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.lang.Integer>> listener)
        Gets total unread count of messages for all Groups
        Parameters:
        listener - An object of the CallbackListener<HashMap<String,Integer>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • getUnreadMessageCountForAllGroups

        public static void getUnreadMessageCountForAllGroups​(boolean hideMessagesFromBlockedUsers,
                                                             CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.lang.Integer>> listener)
        Gets total unread count of messages for all Groups
        Parameters:
        hideMessagesFromBlockedUsers - boolean parameter to show or hide messages count of the blocked user
        listener - An object of the CallbackListener<HashMap<String,Integer>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • editMessage

        public static void editMessage​(BaseMessage message,
                                       CometChat.CallbackListener<BaseMessage> listener)
        A method to edit/update a message
        Parameters:
        message - An object of the BaseMessage class which requires receiverUid,type and receiverType BaseMessage(String receiverUid, String type, @CometChatConstants.ReceiverTypes String receiverType)
        listener - An object of the CallbackListener<BaseMessage> class that helps inform the developer if the operation was successful or any error occurred
        See Also:
        CometChatConstants.ReceiverTypes, CometChat.CallbackListener
      • deleteMessage

        public static void deleteMessage​(int messageId,
                                         CometChat.CallbackListener<BaseMessage> listener)
        A method to delete a message
        Parameters:
        messageId - Id of the message to be deleted
        listener - An object of the CallbackListener<BaseMessage> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChatConstants.ReceiverTypes, CometChat.CallbackListener
      • addMembersToGroup

        public static void addMembersToGroup​(java.lang.String GUID,
                                             java.util.List<GroupMember> members,
                                             java.util.List<java.lang.String> bannedUserIds,
                                             CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.lang.String>> listener)
        To add members to a Group developer can call this method
        Parameters:
        GUID - Unique Identifier of the Group
        members - List of Group members to added into the group
        bannedUserIds - List of members to be banned into the group
        listener - An object of the CallbackListener<HashMap<String,String>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        v1
        See Also:
        CometChat.CallbackListener
      • registerTokenForPushNotification

        public static void registerTokenForPushNotification​(java.lang.String fcmToken,
                                                            CometChat.CallbackListener<java.lang.String> listener)
        To register for the push notifications for the logged in user
        Parameters:
        fcmToken - fcm Token required for receiving push notifications
        listener - An object of the CallbackListener<HashMap<String,String>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        2.0.2
        See Also:
        CometChat.CallbackListener
      • registerTokenForPushNotification

        public static void registerTokenForPushNotification​(java.lang.String fcmToken,
                                                            JSONObject params,
                                                            CometChat.CallbackListener<java.lang.String> listener)
        To register for the push notifications for the logged in user along with custom params.
        Parameters:
        fcmToken - fcm Token required for receiving push notifications
        params - A JSONObject which can be used to pass extra parameters.
        listener - An object of the CallbackListener<HashMap<String,String>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        2.0.2
        See Also:
        CometChat.CallbackListener
      • createUser

        public static void createUser​(User user,
                                      java.lang.String apiKey,
                                      CometChat.CallbackListener<User> listener)
        To create users on the fly.
        Parameters:
        user - object of the User class containing the data for the User.
        apiKey - Auth API Key.
        listener - An object of the CallbackListener<User> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        2.0.3
        See Also:
        CometChat.CallbackListener
      • updateUser

        public static void updateUser​(User user,
                                      java.lang.String apiKey,
                                      CometChat.CallbackListener<User> listener)
        To update users on the fly.
        Parameters:
        user - object of the User class containing the data for the User.
        apiKey - Auth API Key.
        listener - An object of the CallbackListener<User> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        2.0.3
        See Also:
        CometChat.CallbackListener
      • getJoinedGroups

        public static void getJoinedGroups​(CometChat.CallbackListener<java.util.List<java.lang.String>> listener)
        To get the list of all the joined groups for the Logged-in user.
        Parameters:
        listener - An object of the CallbackListener<<String>> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        2.0.3
        See Also:
        CometChat.CallbackListener
      • getConversation

        public static void getConversation​(java.lang.String conversationWith,
                                           java.lang.String conversationType,
                                           CometChat.CallbackListener<Conversation> listener)
        To get individual conversation for a particular user or group.
        Parameters:
        conversationWith - The uid/guid of the user/group for which the conversation is to be fetched.
        conversationType - The type of the conversation(user/group)
        listener - An object of the CallbackListener<Conversation> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        2.0.4
        See Also:
        CometChat.CallbackListener
      • tagConversation

        public static void tagConversation​(java.lang.String conversationWith,
                                           java.lang.String conversationType,
                                           java.util.List<java.lang.String> tags,
                                           CometChat.CallbackListener<Conversation> listener)
      • setSource

        public static void setSource​(java.lang.String resource,
                                     java.lang.String platform,
                                     java.lang.String language)
      • callExtension

        public static void callExtension​(java.lang.String slug,
                                         java.lang.String requestType,
                                         java.lang.String endPoint,
                                         JSONObject body,
                                         CometChat.CallbackListener<JSONObject> listener)
        To trigger push notification related operations directly via the SDKs.
        Parameters:
        slug - Slug of the extension
        requestType - Type of the request
        endpoint - Endpoint of the URL For the respective extension
        listener - An object of the CallbackListener<JSONObject> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        2
        See Also:
        CometChat.CallbackListener
      • isFeatureEnabled

        public static void isFeatureEnabled​(java.lang.String featureName,
                                            CometChat.CallbackListener<java.lang.Boolean> listener)
        To detemine if a specific feature is enabled.
        Parameters:
        featureName - Name of the feature to be checked
        listener - An object of the CallbackListener<Boolean> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        2.0
        See Also:
        CometChat.CallbackListener
      • isExtensionEnabled

        public static void isExtensionEnabled​(java.lang.String extensionId,
                                              CometChat.CallbackListener<java.lang.Boolean> listener)
        To determine if a specific extension is enabled.
        Parameters:
        featureName - Name of the extension to be checked
        listener - An object of the CallbackListener<Boolean> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        2.0
        See Also:
        CometChat.CallbackListener
      • getExtensionDetails

        public static void getExtensionDetails​(java.lang.String extensionId,
                                               CometChat.CallbackListener<com.cometchat.pro.models.CCExtension> listener)
        To get details of a particular extension
        Parameters:
        featureName - Id of the extension for which the details are to be fetched
        listener - An object of the CallbackListener<@Link{CCExtension}> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        2.0
        See Also:
        CometChat.CallbackListener
      • getCallParticipantCount

        public static void getCallParticipantCount​(java.lang.String sessionId,
                                                   java.lang.String type,
                                                   CometChat.CallbackListener<java.lang.Integer> listener)
        This method helps to get the count of the participants in any particular call..
        Parameters:
        sessionId - The session Id of the call for which the participant count is to be fetched
        type - The type of the call(direct/default)
        listener - An object of the CallbackListener<Integer> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        2.0.4
        See Also:
        CometChat.CallbackListener
      • updateCurrentUserDetails

        public static void updateCurrentUserDetails​(User user,
                                                    CometChat.CallbackListener<User> listener)
        To update the details of the logged in user.
        Parameters:
        user - An object of the @link{User} class containing the details to be updated
        listener - An object of the CallbackListener<@link{User}> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        2.0
        See Also:
        CometChat.CallbackListener
      • deleteConversation

        public static void deleteConversation​(java.lang.String conversationWith,
                                              java.lang.String conversationType,
                                              CometChat.CallbackListener<java.lang.String> listener)
        To delete a specific conversation for the logged in user.
        Parameters:
        conversationWith - The UID/GUID of the conversation to be deleted.
        conversationType - The type of the conversations (user/group)
        listener - An object of the CallbackListener<String> class that helps inform the developer if the operation was successful or any error occurred
        Since:
        2.0
        See Also:
        CometChat.CallbackListener
      • sendTransientMessage

        public static void sendTransientMessage​(com.cometchat.pro.models.TransientMessage transientMessage)
        To send a transient message to a user or a group.
        Parameters:
        transientMessage - An object of the @link{TransientMessage}.
        Since:
        2.0
        See Also:
        CometChat.CallbackListener
      • getOnlineGroupMemberCount

        public static void getOnlineGroupMemberCount​(java.util.List<java.lang.String> guids,
                                                     CometChat.CallbackListener<java.util.HashMap<java.lang.String,​java.lang.Integer>> listener)
        To get the count of online users in specific groups.
        Since:
        2.0
        See Also:
        CometChat.CallbackListener
      • addMessageListener

        public static void addMessageListener​(java.lang.String listenerID,
                                              CometChat.MessageListener listener)
        To receive different types of messages Developer needs to make use of this method
        Parameters:
        listenerID - Unique Identifier for the Listener
        listener - An object of the MessageListener class
        Since:
        v1
        See Also:
        CometChat.MessageListener
      • removeMessageListener

        public static void removeMessageListener​(java.lang.String listenerID)
        To stop receiving messages developer can make use of this method
        Parameters:
        listenerID - Unique Identifier for the Listener which was used in addMessageListener()
        Since:
        v1
      • addUserListener

        public static void addUserListener​(java.lang.String listenerID,
                                           CometChat.UserListener listener)
        To receive presence information of users Developer needs to make use of this method
        Parameters:
        listenerID - Unique Identifier for the Listener
        listener - An object of the UserListener class
        Since:
        v1
        See Also:
        CometChat.UserListener
      • removeUserListener

        public static void removeUserListener​(java.lang.String listenerID)
        To stop receiving presence information of different users developer can make use of this method
        Parameters:
        listenerID - Unique Identifier for the Listener which was used in addUserListener()
        Since:
        v1
      • addCallListener

        public static void addCallListener​(java.lang.String listenerId,
                                           CometChat.CallListener callListener)
        To receive call events Developer needs to make use of this method
        Parameters:
        listenerId - Unique Identifier for the Listener
        callListener - An object of the CallListener class
        Since:
        v1
        See Also:
        CometChat.CallListener
      • removeCallListener

        public static void removeCallListener​(java.lang.String listenerId)
        To stop receiving Call event developer can make use of this method
        Parameters:
        listenerId - Unique Identifier for the Listener which was used in addCallListener()
        Since:
        v1
      • addConnectionListener

        public static void addConnectionListener​(java.lang.String listenerId,
                                                 CometChat.ConnectionListener connectionListener)
        To receive connection events Developer needs to make use of this method
        Parameters:
        listenerId - Unique Identifier for the Listener
        connectionListener - An object of the ConnectionListener class
        Since:
        v2
        See Also:
        CometChat.CallListener
      • removeConnectionListener

        public static void removeConnectionListener​(java.lang.String listenerId)
        To stop receiving Connection events developer can make use of this method
        Parameters:
        listenerId - Unique Identifier for the Listener which was used in addConnectionListener()
        Since:
        v1
      • addGroupListener

        public static void addGroupListener​(java.lang.String listenerId,
                                            CometChat.GroupListener groupListener)
        To receiver Group Actions developer can make use of this method
        Parameters:
        listenerId - Unique Identifier for the Listener
        groupListener - An object of the GroupListener class
        Since:
        v1
        See Also:
        CometChat.GroupListener
      • removeGroupListener

        public static void removeGroupListener​(java.lang.String listenerId)
        To stop receiving Group event developer can make use of this method
        Parameters:
        listenerId - Unique Identifier for the Listener which was used in addGroupListener()
        Since:
        v1
      • getLoggedInUser

        public static User getLoggedInUser()
        Get information about logged in User
        Returns:
        User object which contains information about the logged in user
        Since:
        v1
        See Also:
        User
      • addLoginListener

        public static void addLoginListener​(java.lang.String listenerId,
                                            CometChat.LoginListener loginListener)
      • removeLoginListener

        public static void removeLoginListener​(java.lang.String listenerId)