IMIconnect Developer Hub

Welcome to the IMIconnect developer hub. You'll find all the resources to help you get started with IMIconnect quickly. We are here to support you if you get stuck. Let's jump right in!

Get Started

The IMIconnect UI SDK for Android builds on the message transport capabilities exposed within the Core SDK through a collection of customisable user interface components. These components may be used to easily integrate a fully featured rich messaging capability within a host application.

This document serves as a reference and details all of the public classes, interfaces, and methods.

New Classes and APIs are added to UI SDK to support message transport capabilities within the Core SDK through a collection of customisable user interface components

Find below, reference and details all of the public classes, interfaces and methods. A quick start guide is also available <insert link here>

Packages

Package
Description

com.imimobile.connect.ui

The root level package; contains base UI and SDK initialization classes.

The following packages have the root package name removed for brevity.

.conversation

Contains UI components for displaying and interacting within a conversation

.conversation.composer

Contains classes used to display a message composer UI.

.conversation.composer.plugins

Contains plugin classes use to support attachments within the composer.

.conversation.fragments

Contains pre-built fragments for displaying a conversation and conversations list.

.data

Contains data classes

.data.messagepart

Contains data classes that represent parts of a message

.enums

Contains enumerations

.inbox

Contains classes used to display messages in an inbox style UI

.interfaces

Contains various interfaces

.utils

Contains utility classes

.views.partviews

Contains base UI classes used to display message parts.

.views.partviews.location

Contains UI classes for displaying location attachments.

.views.partviews.media

Contains base UI class for displaying media attachments.

.views.partviews.media.audio

Contains UI classes for displaying audio attachments.

.views.partviews.media.file

Contains UI classes for displaying arbitrary file attachments.

.views.partviews.media.image

Contains UI classes for displaying image attachments.

.views.partviews.media.video

Contains UI classes for displaying video attachments.

.views.partviews.text

Contains UI classes for displaying the textual parts of a message.

.views.partviews.url

Contains UI classes for displaying URL attachments.

com.imimobile.connect.ui

Classes
  • IMIconnectUI
  • ICUIConfig
  • ICMessageViewStyle
  • ICMessageRecyclerView
  • ICMessageViewHolder
  • ICMessageViewFactory
  • ICMessageGroupHeaderViewHolder
  • ICMessageDataProvider

Interfaces

  • ICMessageRecyclerView.ICMessageClickListener
  • ICMessageRecyclerView.ICMessageMenuHandler

IMIconnectUI

This class Handles initialisation of the SDK.

Public Methods
void startup
void shutdown
boolean isStarted
String getSDKVersion

startup


This method initialises the SDK for use. This variant must be called to initialise the SDK before any other features may be used

  Syntax: void startup(android.content.Context context, ICUIConfig config, ICUIStartupCallback callback)

  Parameters:

Parameter
Type
Description

context

content.Context

A valid Application Context

config

A valid ICUIConfig instance which configures aspects of the SDK startup

callback

Used to notify startup success, may be null

Note:

When using download at runtime Emoji support, you should always implement the callback and use UI components until startup is complete.

shutdown


This method provides a means to shutdown the SDK and perform cleanup, after this method is called, none of the SDK features will work

  Syntax: void shutdown(com.imimobile.connect.core.callbacks.ICShutdownCallback callback)

  Parameters:

Parameter
Type
Description

callback

com.imimobile.connect.core.callbacks.ICShutdownCallback

Used to notify shutdown success, may be null

isStarted


This method is used to verify whether the SDK has started or not.

  Syntax: boolean isStarted()

Returns value: Returns a value to state whether the SDK is started or not.

getSDKVersion


This method is used to retrieves/check the sdk build version

  Syntax: String getSDKVersion()

Returns value: Returns the SDK build version

ICUIConfig

This class represents methods for sdk configuration.

ICUIConfig ( Constructor)


This method is used to initialize an ICUIConfig instance with a fileProviderAuthority.

  Syntax: ICUIConfig(@NonNull String fileProviderAuthority)

  Parameters:

Parameter
Type
Description

fileProviderAuthority

String

file provider Authority

Public Methods
boolean isDownloadEmoji()
void setDownloadEmoji(boolean downloadEmoji)
String getfileproviderauthority()

isDownloadEmoji


This Method is used to verify download Emoji value true or not

  Syntax: boolean isDownloadEmoji()

Returns value:
Returns 'true' if Emoji download is true, 'false' otherwise.

setDownloadEmoji


This Method is used to set download Emoji value.

  Syntax: void setDownloadEmoji(boolean downloadEmoji)

  Parameters:

Parameter
Type
Description

downloadEmoji

Boolean

Set the value of downloadEmoji

getFileProviderAuthority


This method returns FileProviderAuthority

  Syntax: String getFileProviderAuthority()

Returns value: Returns the FileProviderAuthority

ICMessageViewStyle

This class provides style attributes that are utilised by ICInboxRecyclerView &ICConversationRecyclerView for customization individual Message view components

setBackgroundResource


This method sets message background resource id

  Syntax: void setBackgroundResource(int resId)

  Parameters:

Parameter
Type
Description

resId

Int

background resource id for message

setTextColor


This method sets message text color

  Syntax: void setTextColor(int color)

  Parameters:

Parameter
Type
Description

color

int

color of message text

setTextLinkColor


This method sets message text link color

  Syntax: void setTextLinkColor(int textLinkColor)

  Parameters:

Parameter
Type
Description

textLinkColor

int

text link color

setTextSize


This method sets message text size

  Syntax: void setTextSize(float size)

  Parameters:

Parameter
Type
Description

size

float

Size of the text

setTextTypeface


This method sets message text typeface

  Syntax: void setTextTypeface(Typeface typeface)

  Parameters:

Parameter
Type
Description

typeface

android.graphics.Typeface

typeface of message text

setMargin


This method sets message text typeface

  Syntax: void setMargin(int left, int right)
  Parameters:

Parameter
Type
Description

left

int

Left margin of message

right

int

Right margin of message

setGravity


This method sets message gravity

  Syntax: void setGravity(int gravity)

  Parameters:

Parameter
Type
Description

gravity

int

gravity for message

getGravity


This method sets message gravity

  Syntax: getGravity()

  Returns value: Returns Gravity for message

getBackgroundResource


This method is used to get the Background resource Id for message

  Syntax: int getBackgroundResource()

  Returns value: Returns background resource Id for message

getTextColor


This method is used to get the Text color for message

  Syntax: int getTextColor()

  Returns value: Returns message text color value in the form of 0xAARRGGBB

getTextLinkColor


This method is used to get the Text link color for message.

  Syntax: int getTextLinkColor()

  Returns value: Return message text link color value in the form of 0xAARRGGBB

getTextSize


This method is used to get the Text Size for message.

  Syntax: float getTextSize()

  Returns value: returns text size for Message

getTextTypeface


This method is used to get the Text typeface for message.

  Syntax: Typeface getTextTypeface()

  Returns value: Returns text typeface for Message. Must be one of the following constant values monospace(3),normal(0),sans(1),serif (2)

getMarginLeft


This method is used to get the margin Left for message.

  Syntax: int getMarginLeft()

  Returns value: Returns margin left value for message

getMarginRight


This method is used to get the margin right for message.

  Syntax: int getMarginLeft()

  Returns value: Returns margin right value for message

getCornerRadius


This method is used to get the Corner radius for the message.

  Syntax: int getCornerRadius()

  Returns value: Returns Corner radius value for message

setCornerRadius


This method set the Corner radius value

  Syntax: int getCornerRadius()

  Parameters:

Parameter
Type
Description

cornerRadius

int

Corner radius value for message

getBackgroundColor


This method is used to get the background color for message.

  Syntax: getBackgroundColor()

  Returns value:** Returns background color for message

setBackgroundColor


This method sets background color for message

  Syntax: void setBackgroundColor(int backgroundColor)

  Parameters:

Parameter
Type
Description

backgroundColor

int

background color for message

getTimeTextSize


This method is used to get the Time Text size for message.

  Syntax: int getTimeTextSize()

  Returns value: Returns Time Text size value for message

setTimeTextSize


This method sets Time Text size for message

  Syntax: void setTimeTextSize(int timeTextSize)

  Parameters:

Parameter
Type
Description

timeTextSize

int

Time Text size value for message

getTimeTextColor


This method is used to get the Time Text Color for message.

  Syntax: int getTimeTextColor()

  Returns value: Returns Time Text Color value for message in the form of 0xAARRGGBB

setTimeTextColor


This method sets Time Text color for message

  Syntax: void setTimeTextColor(int timeTextColor)

  Parameters:

Parameter
Type
Description

timeTextColor

int

Time Text color value for message in the form of 0xAARRGGBB

ICMessageRecyclerView

This class has responsibility to obtain its data through ICMessageDataProvider and uses ICMessageViewHolder instances to display the data.

Public Constructors

public ICMessageRecyclerView(Context context)

public ICMessageRecyclerView(Context context,AttributeSet attrs)

public ICMessageRecyclerView(Context context,AttributeSet attrs,int defStyle)

createMessageAdapter


This method is used to create message Adapter instance

  Syntax: protected ICMessageRecyclerView.MessageAdapter createMessageAdapter()
  Returns value:** returns message adapter

init


This method is used to Initialize the message recycler View

  Syntax: protected void init()

setMessageMenuHandler


This method sets an object which implements ICMessageMenuHandler interface to listen menu build and menu Item click callbacks

  Syntax: void setMessageMenuHandler(ICMessageRecyclerView.ICMessageMenuHandler menuBuilder)

  Parameters:

Parameter
Type
Description

menuBuilder

menu handler listener

createPopupMenu

protected android.support.v7.widget.PopupMenu createPopupMenu(int adapterPosition,

ICMessageViewHolder holder)

registerMessageClickListener

public void registerMessageClickListener(ICMessageRecyclerView.ICMessageClickListener listener)

This method allows to register an object which implements the
ICMessageClickListener interface to listen for Message click listener.

Parameters:

listener - message click Listener

unregisterMessageClickListener

public void unregisterMessageClickListener(ICMessageRecyclerView.ICMessageClickListener listener)

This method allows to unregister a previously registered object which implements
the ICMessageClickListener interface, in order to stop listening for Message
click listener.

Parameters:

listener - message click Listener

setAdapter

public void setAdapter(android.support.v7.widget.RecyclerView.Adapter adapter)

Overrides:

setAdapter in class android.support.v7.widget.RecyclerView

onVisibilityChanged

protected void onVisibilityChanged(View changedView,

int visibility)

Automatically refresh on resume

Overrides:

onVisibilityChanged in class View

refresh

public void refresh()

This method refreshes this adapter based on data set changed

registerPartViewFactories

public void registerPartViewFactories(ICMessagePartViewFactory[] factories)

This method register partView factories to be handled by this message Recycler
View

Parameters:

factories - Array of partView factories to be registered

unregisterPartViewFactories

public void unregisterPartViewFactories(ICMessagePartViewFactory[] factories)

This method unregister partView factories for this message Recycler View

Parameters:

factories - Array of partView factories to be registered

setMessageProvider

public void setMessageProvider(T provider)
throws ICException

This method sets message provider which implements ICMessageDataProvider

Parameters:

provider - message data provider

Throws:

com.imimobile.connect.core.exception.ICException

getMessageProvider

public T getMessageProvider()

This method returns message data provider

Returns:

returns the message data provider

setMessageViewFactory

public void setMessageViewFactory(ICMessageViewFactory\<[V]> factory)

This method sets Message View factory object which inherit from
ICMessageViewFactory

Parameters:

factory – messageViewFactory

setMessageViewStyle

public void setMessageViewStyle(ICMessageViewStyle myStyle,

ICMessageViewStyle theirStyle)

This method sets message view styles for my Messages and Their Messages

Parameters:

myStyle - my message style

theirStyle - their Message style

setUnreadMessageViewStyle

public void setUnreadMessageViewStyle(ICMessageViewStyle unreadStyle)

This method sets message view style for unRead Messages

Parameters:

unreadStyle - unRead message style

setAlertMessageViewStyle

public void setAlertMessageViewStyle(ICMessageViewStyle style)

This method sets alert message view style

Parameters:

style - Alert Message style

setAvatars

public void setAvatars(Bitmap myAvatar,

Bitmap theirAvatar)

This method set avatar for my Message and Their Message

Parameters:

myAvatar - avatar for my message

theirAvatar - avatar for their message

getMyMessageViewStyle

protected ICMessageViewStyle getMyMessageViewStyle()

This method returns my message view style

Returns:

returns my message view style

getTheirMessageViewStyle

protected ICMessageViewStyle getTheirMessageViewStyle()

This method returns their message view style

Returns:

returns their message view style

getUnreadMessageViewStyle

protected ICMessageViewStyle getUnreadMessageViewStyle()

This method returns Unread message view style

Returns:

returns Unread message view style

getAlertMessageViewStyle

protected ICMessageViewStyle getAlertMessageViewStyle()

This method returns Alert message view style

Returns:

returns Alert message view style

ICMessageViewHolder

This abstract class responsibility is to bind ICMessageData and apply styles ICMessageViewStyle to message Views.

Public Methods
void bindAvatar(Bitmap avatar)
void bindMessage(ICMessageData messageData, ICMessagePart[] messageParts)
void setMessageViewStyle(ICMessageViewStyle style)
ICMessagePartContainerViewHolder getPartContainerViewHolder()
View getView()

bindAvatar


This method binds avatar to message view holder

  Syntax: void bindAvatar(Bitmap avatar)

  Parameters:

Parameter
type
Description

avatar

bitmap

avatar bitmap

bindMessage


This method binds message parts to respective message part view holder

  Syntax: void bindMessage(ICMessageData messageData, ICMessagePart[] messageParts)
  Parameters:

Parameter
type
Description

messageData

com.imimobile.connect.core.messaging.ICMessageData messageData

ICMessageData

messageParts

com.imimobile.connect.core.messaging.ICMessageData messageData

an array of message parts

setMessageViewStyle


This method sets message view style to message view holder

  Syntax: void setMessageViewStyle(ICMessageViewStyle style)

  Parameters:

Parameter
type
Description

style

ICMessageViewStyle

Message view style

getPartContainerViewHolder


This method returns message part container view holder.

  Syntax: abstract ICMessagePartContainerViewHolder getPartContainerViewHolder()

  Returns value: Returns message part container view holder

getPartContainerViewHolder


This Method returns Message View holder.

  Syntax: android.view.View getView()

  Returns value: Returns view object for message view holder.

ICMessageViewFactory

This factory has the responsibility to create all the message views that will be displayed in the conversation.

getMessageGroupHeaderViewType


This method used to get message Group Header View type

  Syntax: long getMessageGroupHeaderViewType(ICMessageGroup group)

  Parameters:

Parameter
Type
Description

group

ICMessageGroup

message group

  Returns value: Returns message Group Header View type

createMessageGroupHeaderView


This method used to create message group header View holder.

  Syntax: abstract ICMessageGroupHeaderViewHolder createMessageGroupHeaderView(android.view.ViewGroup parent, long viewType)

  Parameters:

Parameter
Type
Description

parent

android.view.ViewGroup

parent viewgroup

viewType

long

view type

  Returns value: Returns Message group Header View holder object.

getMessageViewIdentifier


This method is to get message view identifier based on message parts and factory map

  Syntax: getMessageViewIdentifier(ICMessageData messageData, ICMessagePart[] messageParts, java.util.Map<String,ICMessagePartViewFactory> factoryMap)

  Parameters:

Parameter
Type
Description

messageData

ICMessageData

message data from adapter position

messageParts

ICMessagePart[]

message parts from data provider

factoryMap

java.util.Map<String,ICMessagePartViewFactory>

message partview factory map

  Returns value: Returns message Group Header View type

createMessageView


This method is used to create message view holder.

  Syntax: createMessageView(android.view.ViewGroup parent, String identifier, java.util.List<ICMessagePartViewFactory> factoryList)

  Parameters:

Parameter
Type
Description

parent

android.view.ViewGroup

parent view group

identifier

String

message view identifier

factoryList

List<ICMessagePartViewFactory>

message part view factory list

  Returns value: Returns created message view holder.

createPartViews


This method used to create part views, message part views are added to message part container View holder.

  Syntax: createPartViews(ICMessageViewHolder<T> messageViewHolder, String identifier,java.util.List<ICMessagePartViewFactory> factoryList)

  Parameters:

Parameter
Type
Description

messageViewHolder

ICMessageViewHolder<T>

implementation of message view holder

identifier

String

message view identifier

factoryList

ICMessagePartViewFactory

message part view factory map

ICMessageGroupHeaderViewHolder

This class binds message group details into message Group View.

bindMessageGroup


This method binds message group details.

  Syntax: void bindMessageGroup(ICMessageGroup messageGroup)

  Parameters:

Parameter
Type
Description

messageGroup

ICMessageGroup

message group details

getView


This method returns message group header view.

  Syntax: View getView()

  Returns value: Returns message group view

ICMessageDataProvider

This class provides an interface to obtain message data for displaying it in ICMessageViewHolder instances.

getMessageGroup


This abstract method is used to get message group.

  Syntax: abstract ICMessageGroup getMessageGroup(int position)

  Parameters:

Parameter
Type
Description

position

Int

message adapter position

  Returns value: Returns message group view

getMessageCount


This abstract method is used to get the message count from message data provider.

  Syntax: abstract int getMessageCount()

  Returns value: Returns the message count from message data provider.

getMessageData


This abstract method is used to get message data details from message data provider

  Syntax: abstract ICMessageData getMessageData(int position)

  Parameters:

Parameter
Type
Description

position

int

message adapter position

  Returns value: Returns MessageData details from message data provider.

getMessageParts


This method is used to get message parts from message details passed.

  Syntax: ICMessagePart[] getMessageParts(ICMessageData message)

  Parameters:

Parameter
Type
Description

message

ICMessageData

message data

  Returns value: Returns array of message parts from message data.

deleteMessage


This method deletes message from data provider based on position

  Syntax: abstract boolean deleteMessage(int position)

  Parameters:

Parameter
Type
Description

Position

Int

Position of the message

  Returns value: Returns true if message deletion is successful , false otherwise

notifyDataSetChanged


This method notifies any registered observers that the data set has changed.

  Syntax: void notifyDataSetChanged()

registerObserver


This method allows registering an object which implements the ICDataSetObserver interface to listen for DataSet changes in Message data provider

  Syntax: registerObserver(ICDataSetObserver observer)

  Parameters:

Parameter
Type
Description

observer

ICDataSetObserver

DataSet observer Listener

unregisterObserver


This method allows unregistering a previously registered object which implements the ICDataSetObserver interface, in order to stop listening for DataSet changes in Message data provider.

  Syntax: unregisterObserver(ICDataSetObserver observer)

  Parameters:

Parameter
Type
Description

observer -

ICDataSetObserver

DataSet observer Listener

ICMessageRecyclerView.ICMessageClickListener

This interface defines for a callback to be invoked when a Message view is clicked

onMessageClick


This method will be invoked when message click event happened

  Syntax: `boolean onMessageClick(int position)``

Parameter
Type
Description

position

int

message position

  Returns value: Returns True if the listener has consumed the message click event, false otherwise.

onMessageLongClick


This method will be invoked when message long click event happened.

  Syntax: `boolean onMessageLongClick(int position)``

Parameter
Type
Description

position

int

message position

  Returns value: True if the listener has consumed the message long click event, false otherwise.

ICMessageRecyclerView.ICMessageMenuHandler

This interface definition to be invoked to listen menu build and menu Item click callbacks

onBuildMenu


This method is used to callback upon popup menu build

  Syntax: PopupMenu onBuildMenu(android.support.v7.widget.PopupMenu popupMenu,int adapterPosition,android.view.View anchor)

Parameter
Type
Descroption

popupMenu

android.support.v7.widget.PopupMenu

a new popup menu

adapterPosition

int

message adapter position

anchor

android.view.View

anchor view

  Returns value: Returns popup menu

onMenuItemClick


This method will be invoked when the menu item was clicked

  Syntax: boolean onMenuItemClick(MenuItem menuItem)

Parameter
Type
Description

menuItem

MenuItem

item the menu item that was clicked

com.imimobile.connect.ui.conversation

Classes

  • ICConversationActivity
  • ICConversationCategory
  • ICConversationMessageViewFactory
  • ICConversationMessageViewHolder
  • ICConversationRecyclerView

Interfaces

  • ICMessageDisplayedListener
  • ICRetryClickListener

ICConversationActivity

This activity leverages the functionality of the lower level components and provides necessary wiring to combine them into a fully featured in app chat experience with minimal code.

The activity supports the display of the user conversation list and provides a means to open them or create new conversations. Select a conversation to display the conversation view and allow users to read, compose and send messages.

Prerequisites

This component requires that a valid ICMessageStore instance is set within the Core SDK by calling ICMessaging.setMessageStore.

Modes of operation

Depending on how the activity is started there are two distinct modes of operation. Each is provided to cover different usage scenarios.

The standard mode of operation presents the conversation listing and allows the user to open an existing conversation or create a new one.

Alternatively, the activity may be started to display a specific conversation directly. This is useful when you need to take your user directly to a specific conversation. Perhaps they have navigated to another area within your application, or even to another application, starting with a conversation id allows you to take your user back to the conversation.

Adaptive Layout

The layout of the activity adapts to the device display, typically when running on a phone the activity will display the conversation list full screen, when a conversation is displayed this replaces the conversation list display. Navigating back from the conversation will cause the conversation list to be re-displayed.

When running on a wide layout (greater than 700dp in landscape), the layout is split into two sections. The conversation list is shown on the left and the active conversation is shown on the right.

Launching the activity

The activity provides two helper methods to start the activity in each of the supported modes of operation

Start


This method Starts the activity to display a specific conversation.

  Syntax: void start(Context context, String conversationId, Bundle extArgs)

  Parameters:

Parameter
Type
Description

context

Android context

conversationId

Conversation Id

extArgs

Bundle with extra arguments

Starts the activity to display a list of conversations.

  Syntax: void start(Context context, ArrayList<ICConversationCategory> categories,ICCustomerDetails customerDetails, Bundle extArgs)

  Parameters:

Styling

The activity may be customised to match the look and feel of your application, this is accomplished by setting styling attributes via XML.

To style the activity you must first declare styles that inherit from the default styles provided by the SDK and specify these custom styles within your app theme. Internally, the activity leverages the ICConversationsFragment and ICConversationFragment, please refer to their styling sections for further information.

ICConversationCategory

Organisations typically have multiple contact points to which a customer might be directed depending on the query. Conversation categories provide the means to drive users to the correct contact point.

The information contained in a ICConversationCategory instance is also used to establish the correct communication stream for a conversation. Within IMIconnect, real-time messages are sent over a stream, the stream is used to direct messages to the correct service to process the message.

Properties

Property Description
Title A user-friendly title
Stream Name Stream name which should be used when creating a new conversation (See ICMessaging.createThread)
Image A bitmap object representing the category
Sub-categories An array list of sub categories

Constructor

ICConversationCategory

public ICConversationCategory(java.lang.String title,
java.lang.String streamName,
android.net.Uri imageUri)

public ICConversationCategory(java.lang.String title,
java.util.ArrayList<ICConversationCategory> subCategories,
android.net.Uri imageUri)

Methods

getImageUri


This Method is used to get uri to an image representing the category, must be a local uri.

  Syntax: `android.net.Uri getImageUri()``

  Return Value: Returns a uri to an image representing the category, must be a local uri.

setImageUri


This Method is used to get uri to an image representing the category, must be a local uri.

  Syntax: `android.net.Uri getImageUri()``

  Parameter

Core UI


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.