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

Core Classes

ICMessaging

This singleton is the main interface to the IMIconnect messaging system, it provides methods that facilitate incoming and outgoing messages, thread and topic management, message status and connection control.

Return Type
Method

void

allowJavascriptInWebviews(boolean allow)
Sets whether JavaScript execution is allowed within WebView instances that are created by the SDK.


void

connect()
Used to establish a connection to receive In App Messages from the IMIconnect platform.


void

createThread(ICThread thread, ICCreateThreadCallback callback)
Creates a thread within the IMIconnect platform from the provided ICThreadobject.


void

disconnect()
Disconnects the In App Messaging connection between the app and IMIconnect platform.


void

fetchMessages(String threadId, Date beforeDate, int limit, ICFetchMessagesCallback callback)
Fetches a list of messages that matches the specified criteria.


void

fetchThreads(Date beforeDate, int limit, ICFetchThreadsCallback callback)
Fetches a list of threads that matches the specified criteria.


void

fetchTopics(int offset, ICFetchTopicsCallback callback)
Fetches the list of topics that are configured for the IMIconnect application.


getConnectionStatus()
Returns the current connection status between the SDK and IMIconnect platform.


getInstance()
Returns the ICMessaging singleton instance, creating it if necessary.


getMessageStore()
Obtains the current message store instance, if set previously via a call to setMessageStore(ICMessageStore).


boolean

isConnected()
This method is used to verify whether the In App Messaging connection is currently connected to IMIconnect.


boolean

isStarted()
Used to determine whether ICMessaging has been started.


void

allowJavascriptInWebviews


Sets whether JavaScript execution is allowed within WebView instances that are created by the SDK. The default value is false.

  Syntax: void allowJavascriptInWebviews(boolean flag)

  Parameters:

Parameter
Type
Description

flag

Boolean

True if WebView Javascript execution should be allowed.

closeThread


Closes a conversation thread.

  Syntax: void closeThread(final ICThread thread, final ICUpdateThreadCallback callback)

  Parameters:

Parameter
Type
Description

thread

A valid instance for the thread that should be closed.

callback

Receives the result of the close operation. If an error occurs then the exception parameter will not be null.

connect


Once the RT feature is enabled in the app asset created on IMIconnect and user registration is done, the App Developer can establish a connection between the app and IMIconnect platform by calling the connect method appropriately. This enables the messages sent from IMIconnect to be received on the app. When the application is running in the background, SDK is disconnected from IMIconnect. While in the disconnected state, incoming In-App messages are not received, however when the application comes to foreground again, SDK will establish a connection with IMIconnect platform and allow messages to be received.

connect is used to establish a connection to receive In-App Messages from the IMIconnect platform.
Connection status events are notified through ICMessagingReceiver.onConnectionStatusChanged and ICMessagingListener.onConnectionStatusChanged.

Throws an ICException if a user is not registered with IMIconnect or if In App Messaging is not enabled.

  Syntax: void connect() throws ICException

  Example:

ICMessaging messaging = ICMessaging.getInstance();

try
{
  messaging.connect();
} 
catch (ICException e) 
{
  Log.e("Connect", e.toString());
}

createThread


Deprecated in v2.7.0, use createThread(ICThread thread, ICCreateThreadCallback callback) instead.

Creates a thread based on the provided streamName and threadTitle.

  Syntax: void createThread(final String streamName, final String threadTitle, final ICCreateThreadCallback callback)

  Parameters:

Parameter
Type
Description

streamName

String

Name of the stream.

threadTitle

String

The thread title.

callback

Invoked to report the result of the operation.

  Example:

ICMessaging.getInstance().createThread(streamName, threadTitle, new ICCreateThreadCallback()
{
  @Override
  public void onCreateThreadComplete(final ICThread thread, final ICException exception)
  {
    if (exception != null)
    {
      Log.e("CreateThread", "createdThread failed! Reason:" + exception.toString());
    }
    else
    {
      Log.d("CreateThread ", "createdThread succeeded!");
    }
  }
});

createThread


Creates a thread within the IMIconnect platform from the provided ICThread object.

  Syntax: void createThread(final ICThread thread, final ICCreateThreadCallback callback)

  Parameters:

Parameter
Type
Description

thread

A valid thread instance that should be created within the remote IMIconnect platform.

callback

Invoked to report the result of the operation.

Always check that the createThread method is successful before using the thread instance further. On successful completion the thread will be populated with a valid identifier.

  Example:

ICThread thread = new ICThread();

thread.setTitle("MyTitle");
thread.setCategory("MyCategory");

ICMessaging.getInstance().createThread(thread, new ICCreateThreadCallback()
{
  @Override
  public void onCreateThreadComplete(final ICThread thread, final ICException exception)
  {
    if (exception != null)
    {
      Log.e("CreateThread", "createdThread failed! Reason:" + exception.toString());
    }
    else
    {
      Log.d("CreateThread ", " createdThread succeeded!");
    }
  }
});

disconnect


Disconnects the In App Messaging connection between the app and IMIconnect platform. If there is no active connection, then this method fails silently.

When the disconnection completes, the event is notified through ICMessagingReceiver.onConnectionStatusChanged and ICMessagingListener.onConnectionStatusChanged.

Throws an ICException if the device is not registered with IMIconnect or if the In App Messaging feature is not enabled.

  Syntax: void disconnect() throws ICException

  Example:

try 
{
  ICMessaging.getInstance().disconnect();
} 
catch (ICException e) 
{
  Log.e("Disconnect", e.toString());
}

fetchMessages


Deprecated, use fetchMessages(String threadId, Date beforeDate, int limit, ICFetchMessagesCallback callback)

Fetches a list of messages that matches the specified criteria. The results are notified through the ICFetchMessagesCallback callback.

  Syntax: fetchMessages(String threadId, Date beforeDate, ICFetchMessagesCallback callback)

fetchMessages


Fetches a list of messages that matches the specified criteria.

Results are notified through ICFetchMessagesCallback and are ordered from newest to oldest.

  Syntax: fetchMessages(String threadId, Date beforeDate, int limit, ICFetchMessagesCallback callback)

  Parameters:

Parameter
Type
Description

threadId

String

Specifies the value of ThreadId.

beforeDate

Date

Filters the list of returned messages to contain only messages where the submittedAt date is before the passed date.

This value is optional; if null is passed, the SDK will use the current Date and Time to fetch recent messages.

limit

int

Limits the number of messages that are fetched.

callback

Invoked to report the result of the operation.

  Example:

ICMessaging.getInstance().fetchMessages(threadId, beforeDate, limit, new ICFetchMessagesCallback()
{
  @Override
  public void onFetchMessagesComplete(final ICMessage[] messages, final boolean hasMoreData, final ICException exception)
  {
    if (exception != null)
    {
      Log.e("fetchMessages", "fetchMessages failed! Reason:" + exception.toString());
      return;
    }
    
    Log.e("fetchMessages", "fetchMessages success:");
  }
});

fetchStreams


Removed in v2.7.0. - Streams are no longer used by the IMIconnect platform, messages are now routed to services based on app associations.

Fetches the list of streams that are associated to the IMIconnect application.

  Syntax: fetchStreams(final ICFetchStreamsCallback callback)

  Parameters:

Parameter
Type
Description

callback

Invoked to report the result of the operation.

ICMessaging.getInstance().fetchStreams(new ICFetchStreamsCallback()
{
  @Override
  public void onFetchStreamsComplete(final ICStream[] streams, final ICException exception)
  {
    if (exception != null)
    {
      Log.e("fetchStreams", "fetchStreams failed! Reason:" + exception.toString());
      return;
    }

    Log.e("fetchStreams", "fetchStreams success:");
  }
});

fetchThreads

Deprecated - Use fetchThreads(Date, int, ICFetchThreadsCallback) instead.

Fetches a list of threads that matches the specified criteria.

Results are reported through the ICFetchThreadsCallback callback and are ordered newest to oldest.

  Syntax: fetchThreads (int limit, ICFetchThreadsCallback callback)

fetchThreads


Fetches a list of threads that matches the specified criteria.

Results are reported through ICFetchThreadsCallback and are ordered newest to oldest.

  Syntax: fetchThreads (Date beforeDate, int limit, ICFetchThreadsCallback callback)

  Parameters:

Parameter
Type
Description

beforeDate

date

Constrains the results to threads that have been created before the provided date.

limit

int

Limits the number of threads that are fetched.

callback

Invoked to report the result of the operation.

  Example:

ICMessaging.getInstance().fetchThreads(beforeDate,10, new ICFetchThreadsCallback()
{
  @Override
  public void onFetchThreadsComplete(final ICThread[] threads, final boolean hasMoreData, final ICException exception)
  {
    if (exception != null)
    {
      Log.e("fetchThreads", "fetchThreads failed! Reason:" + exception.toString());
      return;
    }
    
    Log.e("fetchThreads", "fetchThreads success:");
  }
});

fetchTopics


Fetches the list of topics that are configured for the IMIconnect application.

  Syntax: fetchTopics(int offset, final ICFetchTopicsCallback callback)

  Parameters:

Parameter
Type
Description

offset

Integer

Filters the topics returned to start from the given offset.

callback

Invoked to report the result of the operation.

When the topic list is large, IMIconnect will return a subset of the results. Use the offset parameter to fetch subsequent results.

Hint: Use the 'hasMoreData' parameter of the ICFetchTopicsCallback.onFetchTopicsComplete method to determine when there is additional data to fetch. Keep a track of your fetched record count to use as the offset to the next call.

  Example:

ICMessaging.getInstance().fetchTopics(0, new ICFetchTopicsCallback()
{
  @Override
  public void onFetchTopicsComplete(final ICTopic[] topics, final boolean hasMoreData, final ICException exception)
  {
    if (exception != null)
    {
      Log.e("fetchTopics", "fetchTopics failed! Reason:" + exception.toString());
      return;
    }
     
    Log.e("fetchTopics", "fetchTopics success:");
     
  	if (hasMoreData)   
    {
     	//Fetch more, use accumulation of topics.length for offset
      //i.e. offset += topics.length;
    }
   }
});

getConnectionStatus


Returns the current connection status between the SDK and IMIconnect platform.

  Syntax: ICConnectionStatusgetConnectionStatus()

  Return Value:
  Returns the current connection status between the SDK and the IMIconnect platform.

getInstance


Returns the ICMessaging singleton instance, creating it if necessary.

  Syntax: ICMessaging getInstance()

  Return Value:
  Returns the ICMessaging singleton instance.

getMessageStore


Obtains the current message store instance, if set previously via a call to setMessageStore(ICMessageStore).

  Syntax: ICMessageStoregetMessageStore()

  Return Value:
  The ICMessageStore instance, if set, otherwise null.

isConnected


This method is used to verify whether the In App Messaging connection is currently connected to IMIconnect. This is a convenience method for getConnectionStatus() == ICConnectionStatus.Connected.

  Syntax: boolean isConnected()

  Return Value:
  Returns true if the RTM connection is currently connected.

isStarted


Used to determine whether ICMessaging has been started.

  Syntax: static boolean isStarted()

  Return Value: Returns true if ICMessaging has been started, otherwise false.

The ICMessaging instance is started automatically when the getInstance method is called.

publishMessage


Publishes a message to the IMIconnect platform.

The ICMessage passed to this method must contain a valid ICThread instance.

Results of the operation are reported through ICPublishMessageCallback.

  Syntax: void publishMessage(ICMessage message, ICPublishMessageCallback callback)

  Parameters:

Parameters
Type
Description

message

The message to send to the IMIconnect platform.

callback

Invoked to report the result of the operation.

  Example:

ICMessage message = new ICMessage();
message.setMessage("Test message");
message.setThread(yourThreadObj);

ICMessaging.getInstance().publishMessage(message, new ICPublishMessageCallback()
{
  @Override
  public void onPublishMessageComplete(final ICMessage message, final ICException exception)
  {
    if (exception != null)
    {
      Log.e("PublishMessage", exception.toString());
    }
    else
    {
      Log.d("PublishMessage", "Published Successfully");
    }
  }
});

registerListener

Registers an ICMessagingListener to listen for incoming messages and connection status updates.

Syntax: void registerListener(ICMessagingListener listener)

Parameters
Type
Description

listener

Listener for receiving incoming messages and connection status updates

setMessageAsRead


Updates the status of a message to Read.

The result of the operation is reported through ICSetMessageStatusCallback.

  Syntax: void setMessageAsRead(String transactionId, ICSetMessageStatusCallback callback)

  Parameters:

Parameter
Type
Description

transactionId

String

The transaction id of the message whose status should be set as read. See ICMessage.getTransactionId()

callback

Invoked to report the result of the operation.

  Example:

String messageTransactionId = message.getTransactionId();

ICMessaging.getInstance().setMessageAsRead(messageTransactionId, new ICSetMessageStatusCallback() 
{
  @Override
  public void onSetMessageStatusComplete(final String[] messageTransactionIds, final ICException exception) 
  {
    if (exception != null) 
    {
      Log.e("MessageAsRead", exception.toString());
    } 
    else 
    {
      Log.d("MessageAsRead", "Updated Successfully");
    }
  }
});

setMessagesAsRead


Sets the status for multiple messages to Read.

The result of the operation is reported through ICSetMessageStatusCallback.

  Syntax: void setMessagesAsRead(String[] transactionIds, ICSetMessageStatusCallback callback)

  Parameters:

Parameter
Type
Description

transactionIds

String []

An array of message transaction ids whose status should be set to Read.

callback

Invoked to report the result of the operation.

  Example:

String[] messageTransactionIds = new String[] { "id1", "id2" };

ICMessaging.getInstance().setMessagesAsRead(messageTransactionIds, new ICSetMessageStatusCallback() 
{
  @Override
  public void onSetMessageStatusComplete(final String[] messageTransactionIds, final ICException exception) 
  {
    if (exception != null) 
    {
      Log.e("MessagesAsRead", exception.toString());
    } 
    else 
    {
      Log.d("MessagesAsRead", "Updated Sucessfully");
    }
  }
});

setMessageStore

Sets the ICMessageStore implementation that the SDK will use to persist In App Message data. Passing a null value will remove any previously set store and disable message persistence.

Syntax: void setMessageStore(ICMessageStore messageStore)

  Parameters:

Parameter
Type
Description

messageStore

Pass a valid ICMessageStore implementation to enable In App Message persistence.
Pass null to remove any existing store and disable message persistence.

shutdown


Deprecated - Use shutdown(ICShutdownCallback) instead.

Provides a means to shutdown the messaging module and perform cleanup. There is normally no need to call this method.

Syntax: void shutdown()

shutdown


Provides a means to shutdown the messaging module and perform cleanup. There is normally no need to call this method.

Syntax: void shutdown(ICShutdownCallback callback)

  Parameters:

Parameter
Type
Description

callback

Invoked when shutdown is complete.

  Example:

ICMessaging.shutdown(new ICShutdownCallback()
{
  @Override
  public void onShutdownComplete()
  {
    Log.d("ICMessaging", "Shutdown Completed");
  }
});

subscribeTopic


Subscribes the current user to a topic. After successful completion, the SDK will receive any future messages that are published to the topic.

The result of the operation is reported through ICSubscribeTopicCallback.

  Syntax: void subscribeTopic(String topicId, ICSubscribeTopicCallback callback)

  Parameters:

Parameter
Type
Description

topicId

String

The topic to which the user should be subscribed.

callback

Invoked to report the success of the operation.

  Example:

String topic = "<your topicId>";

ICMessaging.getInstance().subscribeTopic(topicId, new ICSubscribeTopicCallback()
{
  @Override
  public void onSubscribeTopicComplete(final String topicId, final ICException exception) 
  {
    if (exception != null) 
    {
      Log.e("SubscribeTopic", exception.toString());
    } 
    else 
    {
      Log.d("SubscribeTopic", "Subscribed Successfully");
    }
  }
});

unregisterListener


Unregisters a previously registered ICMessagingListener, in order to stop listening for incoming messages and connection status updates.

Syntax: void unregisterListener(ICMessagingListener listener)

Parameters
Type
Description

listener

The listener that should be unregistered. If the listener was not previously registered the method will fail silently.

unsubscribeTopic


Unsubscribes the current user from a topic. After successful completion the user will no longer receive future messages sent to the topic.

The result of the operation are reported through ICUnsubscribeTopicCallback.

  Syntax: void unsubscribeTopic(String topicId, ICUnsubscribeTopicCallback callback)

  Parameters:

Parameter
Type
Description

topicId

String

The topic from which the user should be unsubscribed.

callback

Invoked to report the result of the operation.

  Example:

String topicId = "<your topicId>";

ICMessaging.getInstance().unsubscribeTopic(topicId, new ICUnsubscribeTopicCallback() 
{
  @Override
  public void onUnsubscribeTopicComplete(final String topicId, final ICException exception) 
  {
    if (exception != null) 
    {
      Log.e("UnsubscribeTopic", exception.toString());
    } 
    else 
    {
      Log.d("UnsubscribeTopic", "Unsubscribed Successfully");
    }
  }
});

updateThread


Updates a thread within the remote IMIconnect platform.

  Syntax: void updateThread(ICThread thread, final ICUpdateThreadCallback callback)

  Parameters:

Parameter
Type
Description

thread

The thread instance whose data will be sent to the IMIconnect platform.

callback

Invoked to notify the result of the operation. If an error occurs then the exception parameter will not be null.

ICMessagingReceiver

This class allows the interception of incoming messages and connection status changes, and provides a hook into the push notification generation process. Inherit from this class to substitute or supplement the default functionality. The receiver, or subclass thereof, must be declared within the Android manifest.

//A sample app manifest entry. If you inherit a class from ICMessagingReceiver, replace the name with your class name.

  <receiver
      android:name="YOUR_MESSAGE_RECEIVER_NAME"
      android:enabled="true"
      android:exported="false">
      <intent-filter>
          <action android:name="com.imimobile.connect.core.rtmevent"/>
          <action android:name="com.imimobile.connect.core.notification.click"/>
          <action android:name="com.imimobile.connect.core.intent.notification.RECEIVE"/>
      </intent-filter>
  </receiver>

getNotificationFactory


Override this method to provide a custom ICNotificationFactory implementation in order to customise notifications. It is recommended that you do not return a new instance every time this method is invoked, instead cache your custom instance and return that.

  Syntax: [ICNotificationFactory](#section-icnotificationfactory) getNotificationFactory()

  Return Value:
  The default implementation returns the standard ICNotificationFactory instance.

onConnectionStatusChanged


Invoked whenever there is a change to the In App Messaging connection status. The exception parameter will be populated with error information when status == ICConnectionStatus.Error.

  Syntax: void onConnectionStatusChanged(Context context, ICConnectionStatus status, ICException exception)

  Parameters:

Parameter
Type
Description

context

Context

Refer to Android Context.

status

The new connection status.

exception

Non-null if an error has occurred.

onMessageReceived


Invoked whenever a new Push or In App Message is received.

  Syntax: void onMessageReceived(Context context, ICMessage message)

  Parameters:

Parameter
Type
Description

context

Context

Refer to Android context.

message

The incoming Push or In App Message.

ICNotificationFactory

This class is responsible for creating local notifications for display on the device. By default, the SDK will only produce notifications for Push messages.

Customisations may be introduced by inheriting from this class and overriding onBuildNotification and getActionIconId.

It is possible to completely replace the default notification generation by overriding createNotification instead of onBuildNotification. In this instance you are responsible for building the complete notification and will not get any of the pre-built interactive message functionality.

createNotification


This method is invoked whenever the SDK needs to generate a notification for an incoming message. Override this method to completely replace the notification generation process. To stop notifications from being displayed it is valid to return null from this method.

  Syntax: Notification createNotification(Context context, ICMessage message, int notificationId, Bitmap bigPicture)

  Parameters:

Parameter
Type
Description

context

Context

Refer to Android Context.

message

The message for which to create a notification.

notificationId

int

The id to assign to the notification.

bigPicture

Bitmap

Specifies a bitmap for big picture notifications.

  Return Value:
  Returns an Android notification.

createNotification


This method is invoked whenever the SDK needs to generate a notification for an incoming message. Override this method to completely replace the notification generation process. To stop notifications from being displayed it is valid to return null from this method.

  Syntax: Notification createNotification(Context context, ICMessage message, int notificationId, Bitmap bigPicture)

  Parameters:

Parameter
Type
Description

context

Context

Refer to Android Context.

message

The message for which to create a notification.

notificationId

int

The id to assign to the notification.

bigPicture

Bitmap

Specifies a bitmap for big picture notifications. May be null.

largeIcon

Bitmap

A bitmap to be used for the large icon property of the notification. May be null.

  Return Value:
  Returns an Android notification.

getActionIconId


Override this method to return a drawable resource id to be used for an interactive message action.

  Syntax: int getActionIconId(String action, String identifier, ICMessage message)

  Parameters:

Parameter
Type
Description

action

String

Specifies the interactive notification action. See the Messaging API Reference for more details.

identifier

String

Specifies the interactive action identifier. See the Messaging API Reference for more details.

message

The message for which a notification is being built.

  Return Value:
  The resource id for the icon.

onBuildNotification


This method is invoked at the end of the SDK notification build process and may be used to customise the standard notifications.

  Syntax: void onBuildNotification(Context context, NotificationCompat.Builder builder, ICMessage message, int notificationId)

  Parameters:

Parameter
Type
Description

context

Context

A valid Android Context instance.

builder

The Android NotificationCompat.Builder instance. Used to introduce customisations to the notification.

message

The message for which a notification is being built.

notificationId

integer

The unique id of the notification.

ICMessageData

An interface for interacting with message data.

getAttachments


Returns the attachments that are attached to the message.

  Syntax: ICAttachment[] getAttachments()

  Return Value: Array of message attachments.

getCategory


Returns the category of the message.

  Syntax: String getCategory()

  Return Value: Returns the category of the message.

getChannel


Returns the channel on which the message was received.

  Syntax: ICMessageChannelgetChannel()

  Return Value: Returns the message channel.

getCreatedAt


Returns the date on which the message was created.

  Syntax: Date getCreatedAt()

  Return Value: Returns the date on which the message was created.

getCustomTags


Returns any custom tag data that was sent as part of the message.

  Syntax: Bundle getCustomTags()

  Return Value: Returns the data that was sent as part of the message payload.

getDeliveredAt


Returns the date on which the message was delivered to the device.

  Syntax: Date getDeliveredAt()

  Return Value: The message delivery date.

getExtras


Used to get supplementary data that was sent as part of the message payload. The format of this data is controlled by the IMIconnect platform and enables certain standard features such as interactive messages.

  Syntax: Bundle getExtras()

  Return Value: Returns the supplementary data that was sent along with the message payload.

getMessage


Used to get the textual content of the message that is intended for display to the user.

  Syntax: String getMessage()

  Return Value: Returns the textual message that is intended for display to the user.

getPriority


Used to get the priority of the message.

  Syntax: int getPriority()

  Return Value: Returns the priority of the message.

getReadAt


Used to get the date the message was considered as 'read' by the user.

  Syntax: Date getReadAt()

  Return Value: The date the message was read.

getReference


Used to get the message reference (trigger rule) set within IMIconnect.

  Syntax: String getReference()

  Return Value: Returns the reference (trigger rule) of the message.

getStatus


Returns the current status of the message (None/Sent/NotSent/Delivered/Read)

  Syntax: ICMessageStatusgetStatus()

  Return Value: Returns the current status of the message.

getSubmittedAt


Returns the date on which the message was submitted to the IMIconnect platform.

  Syntax: Date getSubmittedAt()

  Return Value: Message submission date.

getThread


Returns an ICThread instance representing the thread to which the message belongs.

  Syntax: ICThreadgetThread()

  Return Value: The ICThread to which the message belongs.

getTransactionId


Gets the transaction id that uniquely identifies the message within the IMIconnect platform.

  Syntax: String getTransactionId()

  Return Value: Returns the transaction id that identifies the message.

getType


Returns the type of the message.

  Syntax: ICMessageTypegetType()

  Return Value: Returns the message type. See ICMessageType enumeration for details of the possible options.

getUserId


Returns the user id to which the message belongs. This should always be equivalent to the currently registered user.

  Syntax: String getUserId()

  Return Value: Returns the user id to which the message belongs.

isOutgoing


Used to determine whether a message is outgoing (sent by the user) or incoming (sent to the user).

  Syntax: boolean isOutgoing()

  Return Value: Returns 'true' if message is outgoing

ICMessage

This class provides a concrete implementation of the ICMessageData interface to express In App and Push channels in a generalised form and is used when receiving messages to or sending messages from the SDK. In addition to the class specific methods listed below, reference the ICMessageData class for interface method details.

fromJSON


Returns an ICMessage instance from a JSONObject. The JSONObject must contain valid ICMessage data.

  Syntax: static ICMessage fromJSON(JSONObject jsonObj)

  Return Value: An ICMessage instance or null if the jsonObj parameter was null.

getMedia


Deprecated - Use getAttachments instead.

Returns any media files that are attached to the message.

  Syntax: ICMediaFile[] getMedia()

  Return Value:
  Returns the media files that were attached to the message or null if no media file attachments exist.

getTitle


Gets the message title, if present.

  Syntax: String getTitle()

  Return Value: Returns message title if present.

setAttachments


Used to set the attachments which will be sent with an outgoing message.

  Syntax: setAttachments(final ICAttachment[] attachments)

  Parameters:

Parameter
Type
Description

attachments

The attachments to attach to the message.

setCustomTags


This method is used to set the custom tags bundle to be sent with an outgoing RTM. This method is not applicable to Push messaging.

  Syntax: void setCustomTags(Bundle tags)

  Parameters:

Parameter
Type
Description

tags

Bundle

Specifies the Android bundle.

setDeliveredAt


Sets the date on which the message is considered delivered to the device.

The SDK sets the delivered status automatically when a message is received, there should be no need to call this method manually.

  Syntax: void setDeliveredAt(Date date)

  Parameters:

Parameter
Type
Description

date

Date

The date on which the message is considered as delivered.

setMedia


Deprecated - Use setAttachments instead.

Attaches the specified media files to the message.

  Syntax: void setMedia(ICMediaFile[] files)

  Parameters:

Parameter
Type
Description

files

The media file array to attach to the message

setMessage


Used to set the textual part of the message.

  Syntax: void setMessage(String message)

  Parameters:

Parameter
Type
Description

message

String

Specifies the text content of the message.

setReadAt

Sets the date on which the message was considered as Read.

  Syntax: void setReadAt(Date date)

  Parameters:

Parameter
Type
Description

date

Date

The date on which the message was considered as read.

setStatus

Sets the status of the message.

This method has limited use as message status is generally inferred based on delivered and read at dates. i.e. a message with a read at date is considered to be in the Read status.

  Syntax: void setStatus(ICMessageStatus status)

  Parameters:

Parameter
Type
Description

status

ICMessageStatus

The new message status

setThread


Sets the thread instance to which the message belongs.

A valid thread instance must be assigned to a message before it can be published.

When replying to an existing thread, obtain the thread instance from an existing incoming message or from fetchMessages.

When publishing to a new thread, instantiate a new ICThread instance and use createThread to provision the thread within the IMIconnect platform before attempting to publish.

  Syntax: void setThread(ICThread thread)

  Parameters:

Parameter
Type
Description

thread

The thread object to which the message should belong.

toJSON


Returns a JSON representation of the message.

  Syntax: JSONObject toJSON()

  Return Value: Message data as a JSONObject

ICThread

Within IMIconnect all In App messages are compartmentalised into logical threads of conversation. The ICThread class is the local representation of thread data within the IMIconnect SDK.

Threads can be managed via the SDK using the methods exposed by the ICMessaging class and support data attributes such as title, category, status and extras.

Before messages can be published from the SDK a thread must be provisioned within the IMIconnect platform via ICMessaging.createThread or via the web APIs.

When replying to an existing thread, obtain a ICThread instance from an incoming ICMessage or from the ICMessaging.fetchThreads method.

fromJSON


Instantiates a ICThread instance from a JSONObject. The JSONObject must contain valid thread data.

  Syntax: static ICThread fromJSON(JSONObject jsonObj)

  Return Value: A new ICThread instance. Returns null if jsonObj is null.

  Parameters:

Parameter
Type
Description

jsonObj

JSONObject

A JSONObject instance containing valid thread data.

getCategory


Gets the thread category.

  Syntax: String getCategory()

  Return Value: The thread category.

getCreatedAt


Gets the date on which the thread was created within the IMIconnect platform.

  Syntax: Date getCreatedAt()

  Return Value: The thread creation date.

getExternalId


Gets the external id associated to the thread. An external id is a value that may be used to associate the thread with an entity in an external system.

  Syntax: String getExternalId()

  Return Value: The external id, if present, otherwise null.

getExtras


Returns a bundle of any extra data associated to the thread. Extras may be used to associate custom data with a thread.

  Syntax: Bundle getExtras()

  Return Value: Extra data elements associated to the thread, or null if none exists .

getId


Gets the unique identifier of the thread. This value is generated by the IMIconnect platform when the thread is provisioned.

  Syntax: String getId()

  Return Value: The thread id.

getStatus


Returns the status of the thread. See ICThreadStatus for possible values.

  Syntax: ICThreadStatusgetStatus()

  Return Value: The threads current status.

getTitle


Returns the title of the thread.

  Syntax: String getTitle()

  Return Value: The thread title.

getType


Returns the type of thread. See ICThreadType for possible options.

  Syntax: ICThreadType getType()

  Return Value: Returns the thread type.

getUpdatedAt


Returns the date on which the thread was last updated. Changes to thread data, or publication of messages on the thread, will affect this date.

  Syntax: Date getUpdatedAt()

  Return Value: The date the thread was last updated.

setCategory


Sets the category thread.

  Syntax: void setCategory(String category)

  Parameters:

Parameter
Type
Description

category

String

Category of the thread.

setExternalId


Sets the external id value. External ids can be used to associate a thread with an entity in an external system.

  Syntax: void setExternalId(String externalId)

  Parameters:

Parameter
Type
Description

externalId

String

The external id value

setExtras

Sets extra data to be associated with the thread.

  Syntax: void setExtras(Bundle extras)

  *Parameters:

Parameter
Type
Description

Extras

Bundle

The extra data

setTitle


Sets the thread title.

  Syntax: void setTitle(String title)

  Parameters:

Parameter
Type
Description

title

String

Title of the thread.

toJSON


Returns a JSON representation of the thread.

  Syntax: JSONObject toJSON()

  Return Value: Thread data as a JSONObject

ICTopic

This class represents a topic within the IMIconnect platform.

IMIconnect supports topic based messaging, where users may subscribe to, and receive messages on, specific topics of interest.

Return Type
Method

String

String

String

String

boolean

JSONObject

fromJSON


Instantiates a topic from the JSON representation. The JSONObject must contain valid topic data.

  Syntax: static ICTopic fromJSON(JSONObject jsonObj)

  Return Value: A new topic instance, or null if jsonObj is null.

getCreatedOn


Returns the date on which the topic was created.

  Syntax: Date getCreatedOn()

  Return Value: Returns the date on which the topic was created.

getDescription


This method is used to get topic description.

  Syntax: String getDescription()

  Return Value: Returns description of topic.

getGroup


This method is used to get the topic’s group.

  Syntax: String getGroup()

  Return Value: Returns the topic's group.

getId


This method is used to get topic Id.

The topic id is an internal identifier used as the primary key by IMIconnect.

  Syntax: String getId()

  Return Value: Returns the Id for the Topic.

getName


Returns the name of the topic.

The topic name is the textual identifier used to reference the topic within IMIconnect.

  Syntax: String getName()

  Return Value: Returns the name of the topic.

getTitle


Gets the title of the topic.

The topic title is intended as the user friendly value that may be used to populate a UI.

  Syntax: String getTitle()

  Return Value: Returns the topic title.

isSubscribed


Returns whether the current user is subscribed to the topic.

  Syntax: boolean isSubscribed()

  Return Value: Returns true if the current user is subscribed to the topic.

toJSON


Returns a JSON representation of the topic.

  Syntax: JSONObject toJSON()

  Return Value: The topic as a JSONObject.

Core Classes


Suggested Edits are limited on API Reference Pages

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