Class ChatService
- java.lang.Object
-
- Service
-
- com.zopim.android.sdk.api.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 usingZopimChatApi.DefaultConfig
or session configuration provided at start time usingZopimChatApi.SessionConfig
.- See Also:
ZopimChatApi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description class
ChatService.ChatUIStateReceiver
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)
void
clearPushToken()
void
disconnect()
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.void
setPushToken(java.lang.String token)
-
-
-
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 throughZopimChatApi
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()
-
getConfig
public ChatApiConfig getConfig()
-
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 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
-
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)
-
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.
-
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()
-
-