Enum Chat
- java.lang.Object
-
- java.lang.Enum<Chat>
-
- zendesk.chat.Chat
-
-
Enum Constant Summary
Enum Constants Enum Constant and Description INSTANCE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
clearCache()
Clears and data associated with the current chat session.ChatProvidersConfiguration
getChatProvidersConfiguration()
Gets the currentChatProvidersConfigurationStore
boolean
hasIdentity()
Checks whether an identity has been set up for the current chat session.void
init(Context context, java.lang.String accountKey)
Initializes the Chat SDK.void
init(Context context, java.lang.String accountKey, java.lang.String appId)
Initializes the Chat SDK with app id.Providers
providers()
Exposes access to all available providers within the Zendesk Chat SDK.void
resetIdentity()
Resets the visitor details to a clean slate allowing a new visitor to chatvoid
resetIdentity(<any> completionCallback)
Resets the visitor details to a clean slate allowing a new visitor to chatvoid
setChatProvidersConfiguration(ChatProvidersConfiguration chatProvidersConfiguration)
Sets the default configuration used when starting chats from this SDK.void
setIdentity(JwtAuthenticator jwtAuthenticator)
Sets up the Chat SDK to authenticate visitors using the givenJwtAuthenticator
void
setIdentity(JwtAuthenticator jwtAuthenticator, <any> completionCallback)
Sets up the Chat SDK to authenticate visitors using the givenJwtAuthenticator
static Chat
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static Chat[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final Chat INSTANCE
-
-
Method Detail
-
values
public static Chat[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Chat c : Chat.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Chat valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
init
public void init(Context context, java.lang.String accountKey)
Initializes the Chat SDK.Call this method in your
Application#onCreate()
.- Parameters:
context
- context, used to access Android framework APIs.accountKey
- your account key obtained from the web dashboard.
-
init
public void init(Context context, java.lang.String accountKey, java.lang.String appId)
Initializes the Chat SDK with app id.Call this method in your
Application#onCreate()
.- Parameters:
context
- context, used to access Android framework APIsaccountKey
- your account key obtained from the web dashboardappId
- your id for your application
-
providers
public Providers providers()
Exposes access to all available providers within the Zendesk Chat SDK.Make sure to call
Chat.init(Context, String)
first.- Returns:
Providers
ornull> if Chat has not been initialized.
-
setChatProvidersConfiguration
public void setChatProvidersConfiguration(ChatProvidersConfiguration chatProvidersConfiguration)
Sets the default configuration used when starting chats from this SDK.- Parameters:
chatProvidersConfiguration
- the chat Configuration
-
getChatProvidersConfiguration
public ChatProvidersConfiguration getChatProvidersConfiguration()
Gets the currentChatProvidersConfigurationStore
- Returns:
ChatProvidersConfigurationStore
-
setIdentity
public void setIdentity(JwtAuthenticator jwtAuthenticator, <any> completionCallback)
Sets up the Chat SDK to authenticate visitors using the givenJwtAuthenticator
If the visitor was previously unauthenticated, any ongoing chat will be ended, and locally stored information about the visitor will be cleared.
Calling this method unregisters the device for push notifications. To continue receiving push notifications on this device you will need to call
PushNotificationsProvider.registerPushToken(String)
again with your Firebase token.Make sure to call
Chat.init(Context, String)
first. If you do not, calling this method will not authenticate the user.Providing a
JwtAuthenticator
here does not guarantee that the visitor will be authenticated when they start a chat. If the Authenticator callsJwtAuthenticator.JwtCompletion#onError()
, or if the token passed tozendesk.chat.JwtAuthenticator.JwtCompletion#onTokenLoaded(String)
is not valid the conversation willThis method will also clear any
VisitorInfo
set withChat.setChatProvidersConfiguration(ChatProvidersConfiguration)
This is a potentially asynchronous action due to the need to end any existing chat and unregister for chat, any callback passed to this method will be executed when it is completed. Once this method has been called, it is recommended to not attempt to interact with the SDK until the callback has been executed.
- Parameters:
jwtAuthenticator
- theJwtAuthenticator
to use for authenticating visitorscompletionCallback
- an optional callback which will be executed once resetting the identity has been completed and the cache has been cleared
-
setIdentity
public void setIdentity(JwtAuthenticator jwtAuthenticator)
Sets up the Chat SDK to authenticate visitors using the givenJwtAuthenticator
If the visitor was previously unauthenticated, any ongoing chat will be ended, and locally stored information about the visitor will be cleared.
Calling this method unregisters the device for push notifications. To continue receiving push notifications on this device you will need to call
PushNotificationsProvider.registerPushToken(String)
again with your Firebase token.Make sure to call
Chat.init(Context, String)
first. If you do not, calling this method will not authenticate the user.Providing a
JwtAuthenticator
here does not guarantee that the visitor will be authenticated when they start a chat. If the Authenticator callsJwtAuthenticator.JwtCompletion#onError()
, or if the token passed tozendesk.chat.JwtAuthenticator.JwtCompletion#onTokenLoaded(String)
is not valid the conversation will be started as an unauthenticated user. This unauthenticated user will be cleared next time this method is called.This method will also clear any
VisitorInfo
set withChat.setChatProvidersConfiguration(ChatProvidersConfiguration)
This is a potentially asynchronous action due to the need to end any existing chat and unregister for chat. If you wish to continue to interact with Chat after calling this method, it is recommended that you use
#setIdentity(JwtAuthenticator, CompletionCallback)
so that you may be notified when it is safe to continue using the SDK.- Parameters:
jwtAuthenticator
- theJwtAuthenticator
to use for authenticating visitors
-
resetIdentity
public void resetIdentity(<any> completionCallback)
Resets the visitor details to a clean slate allowing a new visitor to chatAny ongoing chat will be ended, and locally stored information about the visitor will be cleared.
This method will clear any Identity set with
Chat.setIdentity(JwtAuthenticator)
. If you wish to set a new Identity, you should call that method with a new instance ofJwtAuthenticator
, you do not need to call this method.This is a potentially asynchronous action due to the need to end any existing chat and unregister for chat, any callback passed to this method will be executed when it is completed. Once this method has been called, it is recommended to not attempt to interact with the SDK until the callback has been executed.
- Parameters:
completionCallback
- an optional callback which will be executed once resetting the identity has been completed and the cache has been cleared
-
resetIdentity
public void resetIdentity()
Resets the visitor details to a clean slate allowing a new visitor to chatAny ongoing chat will be ended, and locally stored information about the visitor will be cleared.
This method will clear any Identity set with
Chat.setIdentity(JwtAuthenticator)
. If you wish to set a new Identity, you should call that method with a new instance ofJwtAuthenticator
, you do not need to call this method.This is a potentially asynchronous action due to the need to end any existing chat and unregister for chat. If you wish to continue to interact with Chat after calling this method, it is recommended that you use
#resetIdentity(CompletionCallback)
so that you may be notified when it is safe to continue using the SDK.
-
hasIdentity
public boolean hasIdentity()
Checks whether an identity has been set up for the current chat session.If a chat has not yet been started, this will return whether a value has been passed to
Chat.setIdentity(JwtAuthenticator)
. As passing a value to this method does not guarantee that the chat session will be successfully authenticated, as there could be issues with the token returned or other failures in the authentication flow, once a chat session has been started this will return true if an authentication token has been successfully retrieved, and false if the chat has been started as unauthenticated.- Returns:
- true if the current session is authenticated, or expected to be authenticated, false if not
-
clearCache
public void clearCache()
Clears and data associated with the current chat session. If you do not callChat.resetIdentity()
orChat.setIdentity(JwtAuthenticator)
, this data will be restored next time a chat is started.
-
-