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
    • 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()
      • setPushToken

        public void setPushToken(java.lang.String token)
      • clearPushToken

        public void clearPushToken()
      • 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.

      • disconnect

        public void disconnect()
      • 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()