public final class ChatClient
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ChatClient.ConnectionState
Enum representing underlying twilsock connection state.
|
static class |
ChatClient.Properties
Properties for client initialization configuration
|
static class |
ChatClient.SynchronizationStatus
Enum representing client initialization status.
|
static class |
ChatClient.SynchronizationStrategy
Enum representing client synchronization strategies.
|
Modifier and Type | Method and Description |
---|---|
static void |
create(android.content.Context context,
java.lang.String token,
ChatClient.Properties properties,
CallbackListener<ChatClient> listener)
Creates a new Chat client instance with a token manager and client properties.
|
void |
dispose() |
Channels |
getChannels()
Channels available to the ChatClient.
|
ChatClient.ConnectionState |
getConnectionState() |
UserInfo |
getMyUserInfo()
Get user info object for current user
|
ChatClient.Properties |
getProperties()
Get properties for current client
|
static java.lang.String |
getSdkVersion()
Returns the version of the Chat SDK.
|
void |
handleNotification(NotificationPayload notification)
Queue the incoming notification with the messaging library for processing.
|
boolean |
isReachabilityEnabled()
Get reachability service status.
|
void |
onMemberChange(Member member)
Called when a Member is changed in the channel the current user is subscribed to.
|
void |
onMemberDelete(Member member)
Called when a Member is deleted from the channel the current user is subscribed to.
|
void |
onMemberJoin(Member member)
Called when a Member is added to the channel the current user is subscribed to.
|
void |
onMessageAdd(Message message)
Called when a Message is added to the channel the current user is subscribed to.
|
void |
onMessageChange(Message message)
Called when a Message is changed in the channel the current user is subscribed to.
|
void |
onMessageDelete(Message message)
Called when a Message is deleted from the channel the current user is subscribed to.
|
void |
onSynchronizationChange(Channel channel)
Called when channel synchronization status changed.
|
void |
onTypingEnded(Member member)
Called when an Member stops typing on a Channel.
|
void |
onTypingStarted(Member member)
Called when an Member starts typing on a Channel.
|
void |
registerGCMToken(java.lang.String token,
StatusListener listener)
Register GCM token for push notification updates.
|
void |
removeListener()
Method to remove listener for this Client.
|
void |
setListener(ChatClientListener listener)
Method to set listener for this Client.
|
static void |
setLogLevel(int level) |
void |
shutdown()
Cleanly shuts down the messaging client when you are done with it.
|
void |
unregisterGCMToken(java.lang.String token,
StatusListener listener)
Unregister from push notification updates.
|
void |
updateToken(java.lang.String token,
StatusListener listener)
Method to update the authentication token for this client.
|
public static java.lang.String getSdkVersion()
public static void create(@NonNull android.content.Context context, java.lang.String token, ChatClient.Properties properties, CallbackListener<ChatClient> listener)
context
- The Application Context from your Android application. Make
sure you don't pass an Activity Context. You can retrieve the
Application Context by calling getApplicationContext() on your
Activity. Cannot be null.token
- Access token for Chat service.properties
- ChatClient initialization propertieslistener
- Callback listener that will receive reference to
the newly initialized ChatClient.public void updateToken(java.lang.String token, StatusListener listener)
token
- A new access token for this Client.listener
- Listener that will receive callback with the result.public Channels getChannels()
public void registerGCMToken(java.lang.String token, StatusListener listener)
token
- The registration token an Android application needs to register with GCM
connection servers before it can receive messages.listener
- Listener that will receive callback with the result.public void unregisterGCMToken(java.lang.String token, StatusListener listener)
token
- The registration token provided for GCM push notification registration.listener
- Listener that will receive callback with the result.public void handleNotification(NotificationPayload notification)
notification
- Notification received from GCMpublic ChatClient.Properties getProperties()
public void shutdown()
public ChatClient.ConnectionState getConnectionState()
public UserInfo getMyUserInfo()
public boolean isReachabilityEnabled()
public void dispose()
public static void setLogLevel(int level)
public void setListener(ChatClientListener listener)
listener
- the listener for this Client.public void removeListener()
public void onMessageAdd(Message message)
ChannelListener
Message.getChannel()
or Message.getChannelSid()
.onMessageAdd
in interface ChannelListener
message
- The message that has been added.public void onMessageChange(Message message)
ChannelListener
Message.getChannel()
or Message.getChannelSid()
.onMessageChange
in interface ChannelListener
message
- The message that changed.public void onMessageDelete(Message message)
ChannelListener
Message.getChannel()
or Message.getChannelSid()
.onMessageDelete
in interface ChannelListener
message
- The message that got deleted.public void onMemberJoin(Member member)
ChannelListener
Member.getChannel()
.onMemberJoin
in interface ChannelListener
member
- The member that joined.public void onMemberChange(Member member)
ChannelListener
Member.getChannel()
.onMemberChange
in interface ChannelListener
member
- The member that changed.public void onMemberDelete(Member member)
ChannelListener
Member.getChannel()
.onMemberDelete
in interface ChannelListener
member
- The member that was deleted.public void onTypingStarted(Member member)
ChannelListener
Member.getChannel()
.onTypingStarted
in interface ChannelListener
member
- The member that started typing.public void onTypingEnded(Member member)
ChannelListener
Member.getChannel()
.onTypingEnded
in interface ChannelListener
member
- The member that stopped typing.public void onSynchronizationChange(Channel channel)
ChannelListener
Channel.SynchronizationStatus
.onSynchronizationChange
in interface ChannelListener
channel
- Callback for this Channel.