Changelog: Twilio IP Messaging Android SDK
Danger
Programmable Chat has been deprecated and is no longer supported. Instead, we'll be focusing on the next generation of chat: Twilio Conversations. Find out more about the EOL process here.
If you're starting a new project, please visit the Conversations Docs to begin. If you've already built on Programmable Chat, please visit our Migration Guide to learn about how to switch.
We recommend using these links in your projects. As we patch bugs, these links will automatically be updated with the fixes.
Links are provided to specific patch versions here. We don't recommend using these links unless you have a specific need for a certain patch of a release.
Note: This release of IP Messaging must be used in conjunction with the Android Twilio Common 0.6.1 version
- Added a call to
onClientSynchronization
callback in listener upon ChatClient.setListener() with current sync state to help resolve a possible race condition on startup - Fixed an issue where
onTypingEnded()
was being called immediately afteronTypingStarted()
Note: This release of IP Messaging must be used in conjunction with the Android Twilio Common 0.6.1 version
- Exposed new SDK Client ConnectionState
1IPMessagingClient.getConnectionState()2IPMessagingClientListener.onConnectionStateChange()
Note: This release of IP Messaging must be used in conjunction with the Android Twilio Common 0.6.1 version
Message.getAttributes()
now explicitly throws JSONException
- Add
Messages.getMessageByIndex()
method. - Add connection timeout handling in
IPMessagingClient.getChannels()
,Channel.getMembers()
andChannel.getMessages()
- it doesn't hang indefinitely now but will return null after connection timeout is detected by twilsock (usually 30 seconds). - Add
Disposable
interface to all Java objects with C++ context counterparts - callingdispose()
will clean up C++ counterpart object and leave java object unusable.- Memory is actually reclaimed after
IPMessagingClient.shutdown()
; the client object will bedispose()
d making it non-reusable.
- Memory is actually reclaimed after
- Add
Member.getChannel()
andMessage.getChannel()
to get Channel object they are contained in. - Add
Message.getMessages()
to get its parent object - Add
NotificationPayload
helper class to parse GCM push data in the user's GcmListener. - Add
Channels.channelBuilder()
to create channel with custom attributes.
- Change default SDK logging level to DEBUG.
- Channels will not lose their set listeners anymore.
- Mark SDK classes
final
- there's no point extending them - Do not silently fail initialisation if null token was passed into
IPMessagingClient.create()
- Reduced internal memory consumption in twilsock buffer from 128Mb to 8Mb
- Remove
Parcelable
support from classes that don't need it
Note: This release of IP Messaging must be used in conjunction with the Android Twilio Common 0.6.1 version
- Fixed a bug where the Client Channel list was not correctly updated when relevant events were received from the service
Note: This release of IP Messaging must be used in conjunction with the Android Twilio Common 0.6.1 version
- (Twilio Common):
TwilioAccessManager
is renamed toAccessManager
- Removed previously deprecated SDK and Client initialization methods
- Removed previously deprecated interface
Constants.InitListener
- Removed previously deprecated method
Channels.loadChannelsWithListener(StatusListener)
- Removed previously deprecated method
IPMessagingClient#getIdentity()
- Removed previously deprecated method
StatusListener.onError()
- Removed previously deprecated method
CreateChannelListener.onError()
- Renamed
TwilioIPMessagingClient
class toIPMessagingClient (without prefix)
- Changed signature of
getMessagesBefore
andgetMessagesAfter
to uselong
index
- Added
IPMessagingClient.removeListener()
andChannel.removeListener()
API calls - Added
Messages.setNoMessagesConsumed()
method to reset a Channels message consumption horizon to none
- Deprecated
Messages.getMessages()
, please useMessages.getLastMessages()
instead - Deprecated method
ChannelListener.onAttributesChange
- Deprecated
TwilioIPMessagingSDK
class and its initialization methods. Replaced with call toIPMessagingClient.create(Context context, AccessManager accessManager, IPMessagingClient.Properties clientProperties, Constants.CallbackListener<IPMessagingClient> listener)
Note: This release of IP Messaging must be used in conjunction with the latest Android Twilio Common 0.3.1 release (see below)
- Fixed a bug where
onToastNotification(String,String)
,onToastSubscribed()
andonToastFailed(ErrorInfo)
GCM callbacks in IPMessagingClientListener where not firing correctly.
Note: This release of IP Messaging must be used in conjunction with the latest Android Twilio Common 0.3.1 release (see below)
- Add convenience signature for Messages.sendMessage():
public Message sendMessage(String messageBody, StatusListener listener);
- Added Reachability read-only properties:
- TwilioIPMessagingClient.isReachabilityEnabled()
- UserInfo.isOnline()
- UserInfo.isNotifiable()
- Added Message attributes
- Format of all attributes (in Channel, Message, and UserInfo) has changed from Map<String,String> to org.json.JSONObject as to support actual arbitrary JSON attributes as per spec.
- Added Channel getDateCreated()/getDateCreatedAsDate()/getDateUpdated()/getDateUpdatedAsDate() methods
- Fixed a crash that occurred when sending and receiving certain emoji characters
- Fixed a crash that occurred when setting a
null
Body for when sending messages - Fixed a crash that occurred when setting a
null
FriendlyName when updating UserInfo
Note: This release of IP Messaging must be used in conjunction with the latest Android Twilio Common 0.3.1 release (see below)
- Deprecated existing SDK and Client initialization methods. Replaced them with a single method: createClient(TwilioAccessManager accessManager, TwilioIPMessagingClient.Properties clientPorperties, Constants.CallbackListener listener).
- TwilioIPMessagingClient.Properties is a properties class for client initialization, with two member fields:
- SynchronizationStrategy synchronizationStrategy;
- int initialMessageCount;
- SynchronizationStrategy sets data synchronization strategy for client initialization phase. Possible values are ALL and CHANNELS_LIST.
- ALL fetches all Channels with Members and Messages.
- CHANNELS_LIST fetches channels list only, plus metadata for joined, invited public channels and all private channels.
- initialMessageCount field controls amount of messages that are loaded by default for each channel when synched. 0 means no messages are synced.
- Constants.CallbackListener is invoked when TwilioIPMessagingClient is initialized and ready to use. At this point channel list is synched and client is in usable state. Reference to TwilioIPMessagingClient is passed to callback.
- Added new object TwilioIPMessagingClient to client initialization phase. This controls client synchronization strategies on the init phase. For more info, look at point 1. Client initialization.
- Added SynchronizationStatus enum to Channel. Possible values are NONE, IDENTIFIER, METADATA, ALL and FAILED. Status can be accessed by invoking method getSynchronizationStatus();
- Single Channel can now be loaded with method synchronize(Constants.CallbackListener listener). Listener is invoked when channel is synchronized with reference to channel passed to callback.
- IPMessagingClientListener interface has a new method to notify when Client synchronization status has changed: onClientSynchronization(TwilioIPMessagingClient.SynchronizationStatus status); Possible values are STARTED, CHANNELS_COMPLETED, COMPLETED and FAILED.
- Support for fetching channel messages on demand with pagination support. Following methods are exposed for Messages:
- getMessagesBefore(int index, int count, Constants.CallbackListener<List> messages);
- getMessagesAfter(int index, int count, Constants.CallbackListener<List> messages);
- getLastMessages(int count, Constants.CallbackListener<List> messages);
- Significant increase in client init and sync speeds.
- New interface Constants.CallbackListener. It is used for asynchronous operations that pass object reference to callback.
- Deprecated interface Constants.InitListener.
- Deprecated method IPMessagingClientListener.onAttributesChange.
- Deprecated previously used SDK and Client init methods. For more info see point 1
- Private channels are now added to channels list on client initialization
- Replaced ChannelListener.onChannelHistoryLoaded(Channel channel) with onSynchronizationChange(Channel channel).
- Replaced IPMessagingClientListener.onChannelHistoryLoaded(Channel channel) with onChannelSynchronizationChange(Channel channel)
- Fixed issue with missing message SID in channel message list
- Fixed an issue where the SDK would crash on attempting to retrieve a channels list with more than 512 combined public and private channels
Note: This release of IP Messaging must be used in conjunction with the latest Android Twilio Common 0.3.1 release (see below)
- IP Messaging: Informational error responses when async operation fails
- Created new ErrorInfo class containing error code and message.
- BREAKING: Replaced IPMessagingClientListener method onError(int errorCode, String errorText) with onError(ErrorInfo error);
- BREAKING: Changed interface Constants.CreateChannelListener to abstract class with empty onError() method stub. Added new method onError(ErrorInfo error) to abstract class.
- BREAKING: Changed interface Constants.StatusListener to abstract class with empty onError() method stub. Added new method onError(ErrorInfo error) to abstract class.
- Native binaries added. Supported platforms are now:
- x86
- x86_64
- arm-v7
- arm-v8
- Interface changes for Twilio Commons:
- BREAKING: Change the public API callback on TwilioAccessManagerListener from onAccessManagerTokenExpire to onTokenExpired
- BREAKING: Change the public API method on TwlioAccessManager from setListener to addListener
- Jar packaging and naming changed:
twilio-common-android-0.3.1.tar.bz2
extracts to directorytwilio-common-android-0.3.1
- jar name used to be
twilio-common-android.jar
and nowtwilio-common-android-0.3.1.jar
- UserInfo with FriendlyName and Attributes
- public void onUserInfoChange(UserInfo userInfo) added to IPMessagingClientListener.java interface. This method is invoked properties of a UserInfo changes for any of the currently logged in User's Channel's Members.
- public UserInfo getUserInfo() to Member.java interface. Returns UserInfo for that Member.
- public UserInfo getMyUserInfo() to TwilioIPMessagingClient.java class. Returns currently logged in Users's UserInfo object.
- Added new class UserInfo with methods:
- String getFriendlyName();
- void setFriendlyName(String friendlyName, StatusListener listener);
- Map
<String, String>
getAttributes(); - void setAttributes(Map
<String, String>
attributes, StatusListener listener); - String getIdentity();
Note: The addition of the onUserInfoChange(UserInfo userInfo) method to the IPMessagingClientListener.java interface is an additive breaking change in that implementations of the Interface will need to override the new event method.
- Fixed crash when invited member accepts invitation
- Remove redundant method MemberImpl.getAttributes()
- Message Consumption Horizon and Read Status
- Member: getLastConsumedMessageIndex() Return members last consumed message index for this channel
- Member: getLastConsumptionTimestamp() Return members last consumed message timestamp for this channel
- Message: getMessageIndex() Returns the index number for this message
- Messages: getLastConsumedMessageIndex() Return the user's last consumed message index for the channel
- Messages: setLastConsumedMessageIndex(long lastConsumedMessageIndex) Set user last consumed message index for the channel
- Messages: advanceLastConsumedMessageIndex(long lastConsumedMessageIndex) Increase user last consumed message index for the channel. Index is ignored if it is smaller than user current index
- Messages: setAllMessagesConsumed() Set last consumed message index to last message index in channel
- Fixed a problem with client listeners not working for channel objects retrieved by unique name
- Fixed usernames with special characters not working
- Fixed an issue where in some cases when moving from a background to a foreground state, automatic reconnection to IP Messaging did not happen
- A single message changed event is triggered when a message is updated. In previous releases, multiple message changed events could fire for a single message update.
- A participant will no longer miss channel updates after leaving and re-joining the same channel in a single session.
Access Tokens:
- Only Access Tokens provide expiry events. Capability Tokens, an authentication format used earlier during the IP Messaging Private Beta, do not raise expiry events.
- Twilio recommends using a minimum Access Token TTL of 4 minutes;
TwilioAccessManager
will alert the client 3 minutes prior to expiry to ensure sufficient time to obtain and set a new token before expiry. tokenExpired
event is called not at expiry but 3 minutes prior to ensure sufficient time to update to new token.updateToken()
onTwilioAccessManager
should be called on a thread other than the one used to receive the event to ensure the token update completes.- Some applications running on Motorola devices may crash when constructing an AccessManager and/or receiving the callback
onTokenUpdated(AccessManager* accessManager)
.
Other items:
loadChannelsWithListener()
needs to be called before retrieving channels viapmessagingClient.getChannels().getChannels()
- UTF-8 encoded characters are not supported in message bodies. (Note: This issue had previously been reported as affecting only emoji characters, but all UTF-8 characters are impacted.)
- The
TwilioIPMessagingClient
initialization methodcreateIPMessagingClientWithToken
will be deprecated in favor ofcreateIPMessagingClientWithAccessManager:
. - The
createChannel(java.lang.String friendlyName,Channel.ChannelType type,Constants.CreateChannelListener listener)
method onChannels
will be deprecated in favor ofcreateChannel(java.util.Map<java.lang.String,java.lang.Object> options, Constants.CreateChannelListener listener)
.
- Fixed an issue when first message in a channel was skipped.
- Added support for identity with spaces.
Access Tokens:
- Only Access Tokens provide expiry events. Capability Tokens, an authentication format used earlier during the IP Messaging Private Beta, do not raise expiry events.
- Twilio recommends using a minimum Access Token TTL of 4 minutes;
TwilioAccessManager
will alert the client 3 minutes prior to expiry to ensure sufficient time to obtain and set a new token before expiry. tokenExpired
event is called not at expiry but 3 minutes prior to ensure sufficient time to update to new token.updateToken()
onTwilioAccessManager
should be called on a thread other than the one used to receive the event to ensure the token update completes.- Some applications running on Motorola devices may crash when constructing an AccessManager and/or receiving the callback
onTokenUpdated(AccessManager* accessManager)
.
Other items:
- Inviting a user to a private channel after they have previously declined an invitation to that channel will not notify the user of the invitation.
loadChannelsWithListener()
needs to be called before retrieving channels viapmessagingClient.getChannels().getChannels()
- UTF-8 encoded characters are not supported in message bodies. (Note: This issue had previously been reported as affecting only emoji characters, but all UTF-8 characters are impacted.)
- The
TwilioIPMessagingClient
initialization methodcreateIPMessagingClientWithToken
will be deprecated in favor ofcreateIPMessagingClientWithAccessManager:
. - The
createChannel(java.lang.String friendlyName,Channel.ChannelType type,Constants.CreateChannelListener listener)
method onChannels
will be deprecated in favor ofcreateChannel(java.util.Map<java.lang.String,java.lang.Object> options, Constants.CreateChannelListener listener)
.
TwilioAccessManager
is a new class for managing the Access Token lifecycle. This class provides token lifecycle events and a mechanism to update the token used by clients through its listeners and exposes a standard interface for managing tokens across both Twilio IP Messaging and Twilio Video SDKs. You can see an example of how to use this new class in the IP Messaging Quickstart Guide.- Your Twilio IP Messaging apps can now register to receive push notifications via Google Cloud Messenger.
- A new method,
setLogLevel(int level)
, allows you to set the log level for the IP Messaging client. - The
shutdown()
method, available on both theTwilioIPMessagingClient
andTwilioIPMessagingSDK
, cleans up local and network resources. - The SDK fires
ChannelListener:onChannelHistoryLoaded(Channel channel)
callback once a Channel object finishes loading.
- Fixed a crash when passing a
null
value for a Channel's unique name. - API calls that take a listener as an argument can now be used with a
null
listener.
Access Tokens:
- Only Access Tokens provide expiry events. Capability Tokens, an authentication format used earlier during the IP Messaging Private Beta, do not raise expiry events.
- Twilio recommends using a minimum Access Token TTL of 4 minutes;
TwilioAccessManager
will alert the client 3 minutes prior to expiry to ensure sufficient time to obtain and set a new token before expiry. tokenExpired
event is called not at expiry but 3 minutes prior to ensure sufficient time to update to new token.updateToken()
onTwilioAccessManager
should be called on a thread other than the one used to receive the event to ensure the token update completes.- Some applications running on Motorola devices may crash when constructing an AccessManager and/or receiving the callback
onTokenUpdated(AccessManager* accessManager)
.
Other items:
- Inviting a user to a private channel after they have previously declined an invitation to that channel will not notify the user of the invitation.
loadChannelsWithListener()
needs to be called before retrieving channels viapmessagingClient.getChannels().getChannels()
- Emoji characters are not currently supported.
- The
TwilioIPMessagingClient
initialization methodcreateIPMessagingClientWithToken
will be deprecated in favor ofcreateIPMessagingClientWithAccessManager:
. - The
createChannel(java.lang.String friendlyName,Channel.ChannelType type,Constants.CreateChannelListener listener)
method onChannels
will be deprecated in favor ofcreateChannel(java.util.Map<java.lang.String,java.lang.Object> options, Constants.CreateChannelListener listener)
.
- Developers can set an optional unique channel name.
- The method
Message.updateMessageBody(java.lang.String body, Constants.StatusListener listener)
has been added, allowing you to update a message's body. - The method
Messages.removeMessage(Message message, Constants.StatusListener listener)
has been added, allowing you ro remove a message. - The callbacks
ChannelListener.onChannelHistoryLoaded(Channel channel)
andIPMessagingClientListener.onChannelHistoryLoaded(Channel channel)
have been added. getVersion()
has been added, returning the Twilio IP Messaging SDK version.
- Fixed a JNI crash when calling listener.
- Fixed an issue with joining public channels.