Class ChatService



  • public class ChatService
    extends Service
    Service that holds the chat session and it's lifecycle.

    Controls chat session communication via WebBinder instance. It will configure chat based on the global configuration provided at initialization time using ZopimChatApi.DefaultConfig or session configuration provided at start time using ZopimChatApi.SessionConfig.

    See Also:
    ZopimChatApi
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      class  ChatService.LocalBinder
      Class used for the client Binder.
    • Constructor Summary

      Constructors 
      Constructor and Description
      ChatService() 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addNote(java.lang.String note) 
      boolean emailTranscript(java.lang.String email) 
      void endChat()
      Ends the current chat.
      protected void finalize() 
      ChatApiConfig getConfig() 
      boolean hasEnded() 
      boolean isRunning() 
      IBinder onBind(Intent intent) 
      void onCreate()
      The system calls this method when the service is first created, to perform one-time setup procedures (before it calls either onStartCommand() or onBind()).
      void onDestroy() 
      int onStartCommand(Intent intent, int flags, int startId)
      Starting a sticky service that has to be stopped explicitly.
      void resend(java.lang.String messageId) 
      void resetTimeout() 
      void send(java.io.File file) 
      void send(java.lang.String message) 
      void sendChatComment(java.lang.String comment) 
      void sendChatRating(ChatLog.Rating rating) 
      void sendEvents(Event... events) 
      boolean sendOfflineMessage(java.lang.String name, java.lang.String email, java.lang.String message) 
      void setDepartment(java.lang.String department) 
      void setEmail(java.lang.String email)
      Sets the email for the user in the current chat session.
      void setName(java.lang.String name)
      Sets the name for the user in the current chat session.
      void setNote(java.lang.String note) 
      void setPhoneNumber(java.lang.String phoneNumber)
      Sets phone number information for the user that is in the current chat session.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ChatService

        public ChatService()
    • Method Detail

      • onCreate

        public void onCreate()
        The system calls this method when the service is first created, to perform one-time setup procedures (before it calls either onStartCommand() or onBind()). If the service is already running, this method is not called.
      • onStartCommand

        public int onStartCommand(Intent intent,
                                  int flags,
                                  int startId)
        Starting a sticky service that has to be stopped explicitly. At this point all configuration params provided through ZopimChatApi will be set.
      • onBind

        public IBinder onBind(Intent intent)
      • onDestroy

        public void onDestroy()
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Throws:
        java.lang.Throwable
      • isRunning

        public boolean isRunning()
      • setDepartment

        public void setDepartment(java.lang.String department)
      • setPhoneNumber

        public void setPhoneNumber(java.lang.String phoneNumber)
        Sets phone number information for the user that is in the current chat session. This information will be visible in the agent dashboard.

        Phone number will be stored in local storage for later retrieval. You can disable visitor info storage via PrefsStorage.disable(). Obtain storage instance through Storage.visitorInfo()

        Parameters:
        phoneNumber - of the visitor
        See Also:
        Agent Dashboard
      • setName

        public void setName(java.lang.String name)
        Sets the name for the user in the current chat session. This information will be visible in the agent dashboard.

        Name will be stored in local storage for later retrieval. You can disable visitor info storage via PrefsStorage.disable(). Obtain storage instance through Storage.visitorInfo()

        Parameters:
        name - of the visitor
        See Also:
        Agent Dashboard
      • setEmail

        public void setEmail(java.lang.String email)
        Sets the email for the user in the current chat session. This information will be visible in the agent dashboard.

        Email will be stored in local storage for later retrieval. You can disable visitor info storage via PrefsStorage.disable(). Obtain storage instance through Storage.visitorInfo()

        Parameters:
        email - of the visitor
        See Also:
        Agent Dashboard
      • setNote

        public void setNote(java.lang.String note)
      • addNote

        public void addNote(java.lang.String note)
      • send

        public void send(java.lang.String message)
      • send

        public void send(java.io.File file)
      • resend

        public void resend(java.lang.String messageId)
      • sendChatComment

        public void sendChatComment(java.lang.String comment)
      • sendEvents

        public void sendEvents(Event... events)
      • endChat

        public void endChat()
        Ends the current chat. This will update the connection status to closed.

        After the chat has ended the service will attempt to stop itself but will remain running until it's unbound from the host activity. All cached attachments will be cleared.

      • hasEnded

        public boolean hasEnded()
      • emailTranscript

        public boolean emailTranscript(java.lang.String email)
      • sendOfflineMessage

        public boolean sendOfflineMessage(java.lang.String name,
                                          java.lang.String email,
                                          java.lang.String message)
      • resetTimeout

        public void resetTimeout()