Class ChatService
- java.lang.Object
-
- Service
-
- com.zopim.android.sdk.api.ChatService
-
public class ChatService extends ServiceService that holds the chat session and it's lifecycle.Controls chat session communication via
WebBinderinstance. It will configure chat based on the global configuration provided at initialization time usingZopimChatApi.DefaultConfigor session configuration provided at start time usingZopimChatApi.SessionConfig.- See Also:
ZopimChatApi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description classChatService.LocalBinderClass 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 booleanemailTranscript(java.lang.String email)voidendChat()Ends the current chat.protected voidfinalize()ChatApiConfiggetConfig()booleanhasEnded()booleanisRunning()IBinderonBind(Intent intent)voidonCreate()The system calls this method when the service is first created, to perform one-time setup procedures (before it calls either onStartCommand() or onBind()).voidonDestroy()intonStartCommand(Intent intent, int flags, int startId)Starting a sticky service that has to be stopped explicitly.voidresend(java.lang.String messageId)voidresetTimeout()voidsend(java.io.File file)voidsend(java.lang.String message)voidsendChatComment(java.lang.String comment)voidsendChatRating(ChatLog.Rating rating)voidsendEvents(Event... events)booleansendOfflineMessage(java.lang.String name, java.lang.String email, java.lang.String message)voidsetDepartment(java.lang.String department)voidsetEmail(java.lang.String email)Sets the email for the user in the current chat session.voidsetName(java.lang.String name)Sets the name for the user in the current chat session.voidsetPhoneNumber(java.lang.String phoneNumber)Sets phone number information for the user that is in the current chat session.
-
-
-
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 throughZopimChatApiwill 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()
-
getConfig
public ChatApiConfig getConfig()
-
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 throughStorage.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 throughStorage.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 throughStorage.visitorInfo()- Parameters:
email- of the visitor- See Also:
- Agent Dashboard
-
send
public void send(java.lang.String message)
-
send
public void send(java.io.File file)
-
resend
public void resend(java.lang.String messageId)
-
sendChatRating
public void sendChatRating(ChatLog.Rating rating)
-
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()
-
-