Class ChattingService


  • @Service
    public class ChattingService
    extends Object
    This is a service class that supports the chat functionalities
    Author:
    swaroop_nath
    • Constructor Detail

      • ChattingService

        public ChattingService()
        initializes the SQLite database and also starts the receiving thread
    • Method Detail

      • uploadMessage

        public void uploadMessage​(String text,
                                  String timestamp,
                                  String sender,
                                  String receiver)
        Function call to upload message on firebase and SQLite database
        Parameters:
        text - The message text
        timestamp - The message timestamp
        sender - The sender of the message
        receiver - The receiver of the message
      • getAllMessages

        public Vector<MyMessage> getAllMessages​(String user)
        A function which returns all the messages sent or received for a particular user from SQLite database
        Parameters:
        user - the user for whom the messages are to be fetched
        Returns:
        A Vector of messages
      • deleteMessage

        public void deleteMessage​(String timestamp,
                                  String sender,
                                  String receiver,
                                  String text)
        A function which deletes a particular message from the database
        Parameters:
        timestamp - The message timestamp
        sender - The sender of the message
        receiver - The receiver of the message
        text - The message text