public class ChatService extends Service implements Chat
Controls chat session communication via WebBinder
instance.
It will configure chat based on the global configuration provided at initialization time using ZopimChat.DefaultConfig
or
session configuration provided at start time using ZopimChat.SessionConfig
.
ZopimChat
Modifier and Type | Class and Description |
---|---|
class |
ChatService.LocalBinder
Class used for the client Binder.
|
START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
Constructor and Description |
---|
ChatService() |
Modifier and Type | Method and Description |
---|---|
boolean |
emailTranscript(String email)
Emails the current chat transcript
|
void |
endChat()
Ends the current chat.
|
ChatConfig |
getConfig()
Gets chat config for the current chat session as configured via
ZopimChat |
boolean |
hasEnded()
Tells if this chat session has ended and can not be continued.
|
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 |
resetTimeout()
Resets chat timeout.
|
void |
send(String message)
Sends the message to the agents.
|
boolean |
sendOfflineMessage(String name,
String email,
String message)
Sends email to agents defined in the dashboard for this account.
|
void |
setDepartment(String department)
Sets a department to the current chat session.
|
void |
setEmail(String email)
Sets the email for the user in the current chat session.
|
void |
setName(String name)
Sets the name for the user in the current chat session.
|
void |
setPhoneNumber(String phoneNumber)
Sets phone number information for the user that is in the current chat session.
|
dump, getApplication, onConfigurationChanged, onLowMemory, onRebind, onStart, onTaskRemoved, onTrimMemory, onUnbind, startForeground, stopForeground, stopSelf, stopSelf, stopSelfResult
attachBaseContext, bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createConfigurationContext, createDisplayContext, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDir, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSystemService, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivity, startActivity, startInstrumentation, startIntentSender, startIntentSender, startService, stopService, unbindService, unregisterReceiver
getDrawable, getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, unregisterComponentCallbacks
public void onCreate()
public int onStartCommand(Intent intent, int flags, int startId)
ZopimChat
will be set.onStartCommand
in class Service
public ChatConfig getConfig()
Chat
ZopimChat
It will reflect ZopimChat.DefaultConfig
configuration values unless overridden via ZopimChat.SessionConfig
at chat start.
public void setDepartment(String department)
ChatApi
Configuring a department in the chat will deliver the chat to the right group of agents supporting that department's inquiries. This information will be visible in the agent dashboard.
Provided department should be one of the departments available in this account.
The list of available departments will be available in LivechatDepartmentsPath
after initialization is complete onChatInitialized()
.
Setting a non defined department will have no effect.
setDepartment
in interface ChatApi
department
- visitor is chatting withpublic void setPhoneNumber(String phoneNumber)
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()
setPhoneNumber
in interface ChatApi
phoneNumber
- of the visitorpublic void setName(String name)
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()
setName
in interface ChatApi
name
- of the visitorpublic void setEmail(String email)
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()
setEmail
in interface ChatApi
email
- of the visitorpublic void send(String message)
ChatApi
This message will appear in the agent dashboard in an active chat queue.
send
in interface ChatApi
message
- to be sentpublic void endChat()
After the chat has ended the service will attempt to stop itself but will remain running until it's unbound from the host activity.
public boolean hasEnded()
Chat
public boolean emailTranscript(String email)
ChatApi
It will send an email to the provided address with the current chat log
emailTranscript
in interface ChatApi
email
- address to send the transcript topublic boolean sendOfflineMessage(String name, String email, String message)
ChatApi
Email must be provided in order for the agent to be able to respond.
sendOfflineMessage
in interface ChatApi
name
- of the visitoremail
- of the visitormessage
- inquirypublic void resetTimeout()
Chat
ZopimChat.DefaultConfig.sessionTimeout(long)
.resetTimeout
in interface Chat