public final class IPMessagingClient
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
IPMessagingClient.ConnectionState
Enum representing underlying twilsock connection state.
|
static class |
IPMessagingClient.Properties
Properties for client initialization configuration
|
static class |
IPMessagingClient.SynchronizationStatus
Enum representing client initialization status
|
static class |
IPMessagingClient.SynchronizationStrategy
Enum representing client synchronization strategies
|
Modifier and Type | Method and Description |
---|---|
static IPMessagingClient |
create(android.content.Context context,
AccessManager accessManager,
IPMessagingClient.Properties properties,
Constants.CallbackListener<IPMessagingClient> listener)
Creates a new IP Messaging client instance with a token manager and client properties.
|
void |
dispose() |
Channels |
getChannels()
List of channels available to the IPMessagingClient.
|
IPMessagingClient.ConnectionState |
getConnectionState() |
android.content.Context |
getContext() |
IPMessagingClientListener |
getListener()
Method to retrieve listener for this Client.
|
UserInfo |
getMyUserInfo()
Get user info object for current user
|
IPMessagingClient.Properties |
getProperties()
Get properties for current client
|
static java.lang.String |
getSdkVersion()
Returns the version of the IP Messaging SDK.
|
void |
handleNotification(java.util.Map<java.lang.String,java.lang.String> notification)
Queue the incoming notification with the messaging library for processing.
|
boolean |
isReachabilityEnabled()
Get reachability service status.
|
void |
onAttributesChange(java.util.Map<java.lang.String,java.lang.String> updatedAttributes)
Called when channel attributes have changed.
|
void |
onChannelAdd(Channel channel)
Called when the current user adds a channel to their list of channels.
|
void |
onChannelChange(Channel channel)
Called when one the channel of the current user is changed.
|
void |
onChannelDelete(Channel channel)
Called when one of the channel of the current user is deleted.
|
void |
onChannelInvite(Channel channel) |
void |
onChannelSynchronizationChange(Channel channel)
This method is simply to conform to IPMessagingClientListener interface
|
void |
onClientSynchronization(IPMessagingClient.SynchronizationStatus state)
Called when client synchronization status changes
|
void |
onConnectionStateChange(IPMessagingClient.ConnectionState state)
Called when client connnection state has changed.
|
void |
onError(ErrorInfo errorInfo)
Called when an errorInfo condition occurs.
|
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 for 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 |
onToastFailed(ErrorInfo errorInfo)
Called when registering for push notifications fails.
|
void |
onToastNotification(java.lang.String channelId,
java.lang.String messageId)
Called when client receives a GCM notification.
|
void |
onToastSubscribed()
Called when you are successfully registered for push notifications.
|
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 |
onUserInfoChange(UserInfo userInfo)
Called when user info is updated for currently loaded users
|
void |
registerGCMToken(java.lang.String token,
Constants.StatusListener listener)
Register GCM token for push notification updates.
|
void |
removeListener()
Method to remove listener for this Client.
|
void |
setIncomingIntent(android.app.PendingIntent intent)
Sets a
PendingIntent that will be sent when an incoming channel invite is received. |
void |
setListener(IPMessagingClientListener 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,
Constants.StatusListener listener)
Unregister from push notification updates.
|
void |
updateToken(java.lang.String accessToken,
Constants.StatusListener listener)
Method to update the authentication token for this client.
|
public static java.lang.String getSdkVersion()
public static IPMessagingClient create(@NonNull android.content.Context context, AccessManager accessManager, IPMessagingClient.Properties properties, Constants.CallbackListener<IPMessagingClient> 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.accessManager
- AccessManager for IPMessagingClientproperties
- Client initialization propertieslistener
- Callback listener with reference to IPMessagingClientpublic void updateToken(java.lang.String accessToken, Constants.StatusListener listener)
accessToken
- an AccessToken for this Client.listener
- Listener that will receive callback with the result.public Channels getChannels()
public void setIncomingIntent(android.app.PendingIntent intent)
PendingIntent
that will be sent when an incoming channel invite is received.intent
- intent to send.public void registerGCMToken(java.lang.String token, Constants.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, Constants.StatusListener listener)
token
- The registration token provided for GCM push notification registration.listener
- Listener that will receive callback with the result.public void handleNotification(java.util.Map<java.lang.String,java.lang.String> notification)
notification
- Notification received from GCMpublic IPMessagingClient.Properties getProperties()
public void shutdown()
public IPMessagingClient.ConnectionState getConnectionState()
public UserInfo getMyUserInfo()
public boolean isReachabilityEnabled()
public android.content.Context getContext()
public void dispose()
public static void setLogLevel(int level)
public IPMessagingClientListener getListener()
public void setListener(IPMessagingClientListener listener)
listener
- the listener for this Client.public void removeListener()
public void onMessageAdd(Message message)
ChannelListener
onMessageAdd
in interface ChannelListener
message
- The message that has been added.public void onMessageChange(Message message)
ChannelListener
onMessageChange
in interface ChannelListener
message
- The message that changed.public void onMessageDelete(Message message)
ChannelListener
onMessageDelete
in interface ChannelListener
message
- The message that got deleted.public void onMemberJoin(Member member)
ChannelListener
onMemberJoin
in interface ChannelListener
member
- The member that joined.public void onMemberChange(Member member)
ChannelListener
onMemberChange
in interface ChannelListener
member
- The member that changed.public void onMemberDelete(Member member)
ChannelListener
onMemberDelete
in interface ChannelListener
member
- The member that was deleted.public void onUserInfoChange(UserInfo userInfo)
IPMessagingClientListener
onUserInfoChange
in interface IPMessagingClientListener
userInfo
- Callback for this UserInfo.public void onError(ErrorInfo errorInfo)
IPMessagingClientListener
onError
in interface IPMessagingClientListener
errorInfo
- ErrorInfo
Object containing errorInfo infopublic void onToastNotification(java.lang.String channelId, java.lang.String messageId)
IPMessagingClientListener
onToastNotification
in interface IPMessagingClientListener
channelId
- Sid of related channelmessageId
- Sid of related message, if applicable, empty string otherwisepublic void onToastSubscribed()
IPMessagingClientListener
onToastSubscribed
in interface IPMessagingClientListener
public void onToastFailed(ErrorInfo errorInfo)
IPMessagingClientListener
onToastFailed
in interface IPMessagingClientListener
errorInfo
- An error indicating the failure.public void onTypingStarted(Member member)
ChannelListener
onTypingStarted
in interface ChannelListener
member
- The member that started typing.public void onTypingEnded(Member member)
ChannelListener
onTypingEnded
in interface ChannelListener
member
- The member that stopped typing.public void onChannelAdd(Channel channel)
IPMessagingClientListener
onChannelAdd
in interface IPMessagingClientListener
channel
- The channel that got added.public void onChannelInvite(Channel channel)
public void onChannelChange(Channel channel)
IPMessagingClientListener
onChannelChange
in interface IPMessagingClientListener
channel
- The channel that changed.public void onChannelDelete(Channel channel)
IPMessagingClientListener
onChannelDelete
in interface IPMessagingClientListener
channel
- The channel that got deleted.public void onChannelSynchronizationChange(Channel channel)
onChannelSynchronizationChange
in interface IPMessagingClientListener
channel
- Callback for this Channel.public void onSynchronizationChange(Channel channel)
ChannelListener
onSynchronizationChange
in interface ChannelListener
channel
- Callback for this Channel.public void onClientSynchronization(IPMessagingClient.SynchronizationStatus state)
IPMessagingClientListener
onClientSynchronization
in interface IPMessagingClientListener
state
- new client synchronization statuspublic void onConnectionStateChange(IPMessagingClient.ConnectionState state)
IPMessagingClientListener
onConnectionStateChange
in interface IPMessagingClientListener
state
- New connection state.public void onAttributesChange(java.util.Map<java.lang.String,java.lang.String> updatedAttributes)
ChannelListener
onAttributesChange
in interface ChannelListener
updatedAttributes
- updated channel attribute.