|
Conversations Android SDK
1.0.1
|
Conversations client - main entry point for the Conversations SDK. More...
Classes | |
| enum | ConnectionState |
| Represents underlying twilsock connection state. More... | |
| interface | ConversationBuilder |
| Helper to create new conversation with provided data. More... | |
| class | FCMToken |
| Class which represents token received by application from the Firebase Cloud Messaging service. More... | |
| enum | LogLevel |
| Log level constants for passing to setLogLevel. More... | |
| interface | Properties |
| Properties for client initialization configuration. More... | |
| enum | SynchronizationStatus |
| Represents client initialization status. More... | |
Public Member Functions | |
Listeners | |
| void | addListener (@NonNull ConversationsClientListener listener) |
| Method to add listener for this Client. More... | |
| void | removeListener (@NonNull ConversationsClientListener listener) |
| Method to remove listener from this Client. More... | |
| void | removeAllListeners () |
| Method to remove all listeners from this Client. | |
Push notifications | |
| void | registerFCMToken (FCMToken token, StatusListener listener) |
| Register Firebase Messaging token for push notification updates. More... | |
| void | unregisterFCMToken (FCMToken token, StatusListener listener) |
| Unregister from Firebase Messaging updates. More... | |
| void | handleNotification (NotificationPayload notification) |
| Queue the incoming notification with the conversations library for processing. More... | |
Users | |
| void | getAndSubscribeUser (String identity, CallbackListener< User > listener) |
| Get user based on user identity and subscribe to real-time updates for this user. More... | |
| List< User > | getSubscribedUsers () |
| Get a list of currently subscribed User objects. More... | |
| User | getMyUser () |
| Get logged in User object. More... | |
Conversations | |
| void | createConversation (String friendlyName, CallbackListener< Conversation > listener) |
| Create a conversation with friendly name. More... | |
| ConversationBuilder | conversationBuilder () |
| Get ConversationBuilder to create conversation with options. More... | |
| void | getConversation (String conversationSidOrUniqueName, CallbackListener< Conversation > listener) |
| Retrieves a conversation with the specified SID or unique name. More... | |
| List< Conversation > | getMyConversations () |
| Request list of user's joined conversations. More... | |
| boolean | isReachabilityEnabled () |
| Get reachability service status. More... | |
Static Public Member Functions | |
| static void | setLogLevel (LogLevel level) |
| Set verbosity level for log messages to be printed to android logcat. More... | |
Lifecycle | |
| static void | create (@NonNull Context context,@NonNull String token,@NonNull Properties properties,@NonNull CallbackListener< ConversationsClient > listener) |
| Creates a new Conversations client instance with a token manager and client properties. More... | |
| void | updateToken (String token, StatusListener listener) |
| Method to update the authentication token for this client. More... | |
| void | shutdown () |
| Cleanly shuts down the messaging client when you are done with it. More... | |
Getters | |
| static String | getSdkVersion () |
| Returns the version of the Conversations SDK. More... | |
| Properties | getProperties () |
| Get properties for current client. More... | |
| ConnectionState | getConnectionState () |
| String | getMyIdentity () |
| Get user identity for current user. More... | |
| List< Participant > | getParticipantsByIdentity (String identity) |
| Get list of all Conversation participants with a given identity. More... | |
Conversations client - main entry point for the Conversations SDK.
| void com.twilio.conversations.ConversationsClient.addListener | ( | @NonNull ConversationsClientListener | listener | ) |
Method to add listener for this Client.
| listener | the listener to add. |
| ConversationBuilder com.twilio.conversations.ConversationsClient.conversationBuilder | ( | ) |
Get ConversationBuilder to create conversation with options.
A pattern to build conversation with options is:
| IllegalStateException | If ConversationClient isn't synchronized properly. |
Example
|
static |
Creates a new Conversations client instance with a token manager and client properties.
Callback listener is invoked with reference to ConversationsClient when client initialization is completed.
| 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 Conversations service. |
| properties | ConversationsClient initialization properties |
| listener | Callback listener that will receive reference to the newly initialized ConversationsClient. |
| void com.twilio.conversations.ConversationsClient.createConversation | ( | String | friendlyName, |
| CallbackListener< Conversation > | listener | ||
| ) |
Create a conversation with friendly name.
This operation creates a new conversation entity on the backend.
| friendlyName | Friendly name of the new conversation. |
| listener | Listener that receives the status of create conversation action. |
| IllegalStateException | If ConversationClient isn't synchronized properly. |
| void com.twilio.conversations.ConversationsClient.getAndSubscribeUser | ( | String | identity, |
| CallbackListener< User > | listener | ||
| ) |
Get user based on user identity and subscribe to real-time updates for this user.
There's a limit on the number of simultaneously subscribed objects in the SDK. This is to reduce consumed memory and network traffic.
| identity | User identity to query. |
| listener | Listener to receive resulting subscribed User object. |
| IllegalStateException | If ConversationClient isn't synchronized properly. |
| ConnectionState com.twilio.conversations.ConversationsClient.getConnectionState | ( | ) |
| void com.twilio.conversations.ConversationsClient.getConversation | ( | String | conversationSidOrUniqueName, |
| CallbackListener< Conversation > | listener | ||
| ) |
Retrieves a conversation with the specified SID or unique name.
| conversationSidOrUniqueName | Identifier for the conversation. |
| listener | Listener to receive the conversation. |
| IllegalStateException | If ConversationClient isn't synchronized properly. |
| List<Conversation> com.twilio.conversations.ConversationsClient.getMyConversations | ( | ) |
Request list of user's joined conversations.
| IllegalStateException | If ConversationClient isn't synchronized properly. |
| String com.twilio.conversations.ConversationsClient.getMyIdentity | ( | ) |
Get user identity for current user.
| User com.twilio.conversations.ConversationsClient.getMyUser | ( | ) |
| List<Participant> com.twilio.conversations.ConversationsClient.getParticipantsByIdentity | ( | String | identity | ) |
Get list of all Conversation participants with a given identity.
The effect of this function is to find and return all Participant instances across multiple conversations with the given identity.
| identity | Participant identity to look up. |
| IllegalStateException | If ConversationClient isn't synchronized properly. |
| Properties com.twilio.conversations.ConversationsClient.getProperties | ( | ) |
Get properties for current client.
|
static |
Returns the version of the Conversations SDK.
| List<User> com.twilio.conversations.ConversationsClient.getSubscribedUsers | ( | ) |
Get a list of currently subscribed User objects.
These objects receive status updates in real-time. When you subcribe to too many users simultaneously, the oldest subscribed users will be automatically unsubscribed.
| IllegalStateException | If ConversationClient isn't synchronized properly. |
| void com.twilio.conversations.ConversationsClient.handleNotification | ( | NotificationPayload | notification | ) |
Queue the incoming notification with the conversations library for processing.
You must call this function if you want the conversations library to call your ConversationsClientListener#onAddedToConversationNotification, ConversationsClientListener#onRemovedFromConversationNotification, or ConversationsClientListener#onNewMessageNotification callbacks.
| notification | Notification received from FCM. |
| boolean com.twilio.conversations.ConversationsClient.isReachabilityEnabled | ( | ) |
Get reachability service status.
| void com.twilio.conversations.ConversationsClient.registerFCMToken | ( | FCMToken | token, |
| StatusListener | listener | ||
| ) |
Register Firebase Messaging token for push notification updates.
| token | The registration token an Android application needs to register with FCM connection servers before it can receive messages. |
| listener | Listener that will receive callback with the result. |
| void com.twilio.conversations.ConversationsClient.removeListener | ( | @NonNull ConversationsClientListener | listener | ) |
Method to remove listener from this Client.
| listener | the listener to remove. |
|
static |
Set verbosity level for log messages to be printed to android logcat.
Default log level is LogLevel#SILENT.
| level | Verbosity level. See LogLevel for supported options. |
| void com.twilio.conversations.ConversationsClient.shutdown | ( | ) |
Cleanly shuts down the messaging client when you are done with it.
It will dispose() the client after shutdown, so it could not be reused.
| void com.twilio.conversations.ConversationsClient.unregisterFCMToken | ( | FCMToken | token, |
| StatusListener | listener | ||
| ) |
Unregister from Firebase Messaging updates.
| token | The FCMToken to unregister. Must be the same token that was passed in registerFCMToken before. |
| listener | Listener that will receive callback with the result. |
| void com.twilio.conversations.ConversationsClient.updateToken | ( | String | token, |
| StatusListener | listener | ||
| ) |
Method to update the authentication token for this client.
| token | A new access token for this Client. |
| listener | Listener that will receive callback with the result. |