ICMessaging

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

Return TypeMethod
voidallowJavascriptInWebviews(boolean allow)
Sets whether JavaScript execution is allowed within WebView instances that are created by the SDK.
voidcloseThread(ICThread thread, ICUpdateThreadCallback callback)
Closes a conversation thread.
voidconnect()
Used to establish a connection to receive In App Messages from the Webex Connect platform.
voidcreateThread(String streamName, String threadTitle, ICCreateThreadCallback callback) - Removed
voidcreateThread(ICThread thread, ICCreateThreadCallback callback)
Creates a thread within the Webex Connect platform from the provided ICThreadobject.
voiddisconnect()
Disconnects the In App Messaging connection between the app and Webex Connect platform.
voidfetchMessages(String threadId, Date beforeDate, ICFetchMessagesCallback callback)
Deprecated.
voidfetchMessages(String threadId, Date beforeDate, int limit, ICFetchMessagesCallback callback)
Fetches a list of messages that matches the specified criteria.
voiddeleteMessage(String messageTransactionId, ICDeleteMessageCallback callback)
voidfetchThreads(Date beforeDate, ICFetchThreadsCallback callback)
Deprecated.
voidfetchThreads(Date beforeDate, int limit, ICFetchThreadsCallback callback)
Fetches a list of threads that matches the specified criteria.
voidfetchUnreadThreadCount(final ICFetchUnReadThreadCountCallback callback)
Fetches the count of unread threads.
voidfetchTopics(int offset, ICFetchTopicsCallback callback)
Fetches the list of topics that are configured for the Webex Connect application.
ICConnectionStatusgetConnectionStatus()
Returns the current connection status between the SDK and Webex Connect platform.
ICMessaginggetInstance()
Returns the ICMessaging singleton instance, creating it if necessary.
ICMessageStoregetMessageStore()
Obtains the current message store instance, if set previously via a call to setMessageStore.
booleanisConnected()
This method is used to verify whether the In App Messaging connection is currently connected to Webex Connect.
booleanisStarted()
Used to determine whether ICMessaging has been started.
voidpublishMessage(ICMessage message, ICPublishMessageCallback callback)
Publishes a message to the Webex Connect platform.
voidregisterListener(ICMessagingListener listener)
Registers an ICMessagingListener to listen for incoming messages and connection status updates.
voidsetMessageAsRead(String transactionId, ICSetMessageStatusCallback callback)
Updates the status of a message to Read.
voidsetMessagesAsRead(String[] transactionIds, ICSetMessageStatusCallback callback)
Sets the status for multiple messages to Read.
voidsetMessageStore(ICMessageStore store)
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.
voidshutdown()
Deprecated - Use shutdown(ICShutdownCallback) instead.
voidshutdown(ICShutdownCallback callback)
It provides a means to shut down the messaging module and perform the cleanup. There is normally no need to call this method.
voidsubscribeTopic(String topic, ICSubscribeTopicCallback callback)
Subscribes the current user to a topic. After successful completion, the SDK will receive any future messages that are published to the topic.
voidunregisterListener(ICMessagingListener listener)
Unregisters a previously registered ICMessagingListener, in order to stop listening for incoming messages and connection status updates.
voidunsubscribeTopic(String topic, ICUnsubscribeTopicCallback callback)
Unsubscribes the current user from a topic. After successful completion, the user will no longer receive future messages sent to the topic.
voidupdateThread(ICThread thread, ICUpdateThreadCallback callback)
Updates a thread within the remote Webex Connect platform.
voidprocessPushData
To handle push message received from Webex Connect platform.
voidisConnectPushData This helper method returns whether the message is from the Webex Connect platform or not.
voidprocessPushToken
To handle the new push registration token.
StringgetPushToken
Gets the push token of the current device
voidaddPushTokenListener
Adds an object which implements the ICPushTokenListener interface to listen for updated token
voidremovePushTokenListener
Removes a previously added object which implements the ICPushTokenListener interface, in order to stop listening for updated token

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:

ParameterTypeDescription
flagBooleanTrue if WebView Javascript execution should be allowed.

closeThread

Closes a conversation thread.

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

  Parameters:

ParameterTypeDescription
threadICThreadA valid instance for the thread that should be closed.
callbackICUpdateThreadCallbackReceives 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 Webex Connect  and user registration is done, the App Developer can establish a connection between the app and Webex Connect platform by calling the connect method appropriately. This enables the messages sent from Webex Connect to be received on the app. When the application is running in the background, SDK is disconnected from Webex Connect. 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 the Webex Connect platform and allow messages to be received.

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

📘

Throws an ICException if a user is not registered with Webex Connect 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:

ParameterTypeDescription
streamNameStringName of the stream.
threadTitleStringThe thread title.
callbackICCreateThreadCallbackInvoked 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 Webex Connect platform from the provided ICThread object.

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

  Parameters:

ParameterTypeDescription
threadICThreadA valid thread instance that should be created within the remote Webex Connect platform.
callbackICCreateThreadCallbackInvoked 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 the Webex Connect 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 Webex Connect 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:

ParameterTypeDescription
threadIdStringSpecifies the value of ThreadId.
beforeDateDateFilters 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.
limitintLimits the number of messages that are fetched.
callbackICFetchMessagesCallbackInvoked 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:");
  }
});

deleteMessage

Invoke deleteMessage to delete the given message transaction id from the Webex Connect platform.

The result of the operation is reported through ICDeleteMessageCallback.

Syntax: deleteMessage(String messageTransactionId, ICDeleteMessageCallback callback)

Parameters:

ParemeterTypeDescription
messageTransactionIdStringThe transaction id of the message. See ICMessage.getTransactionId().
callbackICDeleteMessageCallbackNull if the operation succeeded.

  Example:

String messageTransactionId = message.getTransactionId();
ICMessaging.getInstance().deleteMessage(messageTransactionId, new ICDeleteMessageCallback() {
 @Override
 public void onDeleteMessageComplete(final String messageTransactionId, final ICException exception) {
  if (exception != null) {
   Log.e("DeleteMessage", exception.getLocalizedMessage(), exception);
   return;
  }
  Log.d("DeleteMessage", "Message deleted successfully, transactionId: " + messageTransactionId);
 }
});

Callbacks

Below are the classes that have been created to implement for this Release:

  • ICPublishEventCallback
  • ICDeleteMessageCallback

ICPublishEventCallback

Used to receive the result of publishing events operations made via IMIconnect.publishEvent

Return TypeMethod
voidonPublishEventComplete(Bundle bundle, ICException exception)

onPublishEventComplete

Invoked to report the result of publishing event operations. If the operation succeeds the exception parameter will be null.

Syntax: void onPublishEventComplete(Bundle bundle, ICException exception)

Parameters:

ParameterTypeDescription
bundleBundleReserved for future use.
exceptionICExceptionNull if the operation succeeded.

ICDeleteMessageCallback

Used to receive the result of delele message operations made via ICMessaging.deleteMessage

Return TypeMethod
voidonDeleteMessageComplete(String messageTransactionId, ICException exception)

onDeleteMessageComplete

Invoked to report the result of delete message operations. If the operation succeeds the exception parameter will be null.

Syntax: void onDeleteMessageComplete(String messageTransactionId, ICException exception)

Parameters:

ParameterTypeDescription
messageTransactionIdStringMessage’s transaction id
exceptionICExceptionNull if the operation succeeded.

getServerDomain

Returns the server domain.

Syntax: String getServerDomain()

Return Value: Returns the server domain.

fetchStreams

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

Fetches the list of streams that are associated with the Webex Connect application.

  Syntax: fetchStreams(final ICFetchStreamsCallback callback)

  Parameters:

ParameterTypeDescription
callbackICFetchStreamsCallbackInvoked 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:

ParameterTypeDescription
beforeDatedateConstrains the results to threads that have been created before the provided date.
limitintLimits the number of threads that are fetched.
callbackICFetchThreadsCallbackInvoked 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:");
  }
});

fetchUnreadThreadCount

Fetches the count of unread threads.

Syntax: fetchUnreadThreadCount(final ICFetchUnReadThreadCountCallback callback)

Parameters:

ParameterTypeDescription
callbackICFetchUnReadThreadCountCallbackThe callback is to be invoked with the count of unread threads.

fetchTopics

Fetches the list of topics that are configured for the Webex Connect application.

  Syntax: fetchTopics(int offset, final ICFetchTopicsCallback callback)

  Parameters:

ParameterTypeDescription
offsetIntegerFilters the topics returned to start from the given offset.
callbackICFetchTopicsCallbackInvoked to report the result of the operation.

📘

When the topic list is large, Webex Connect 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 Webex Connect platform.

  Syntax: ICConnectionStatus getConnectionStatus()

  Return Value: Returns the current connection status between the SDK and the Webex Connect 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: ICMessageStore getMessageStore()

  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 Webex Connect. This is a convenience method for getConnectionStatus() == ICConnectionStatus.Connected.

  Syntax: boolean isConnected()

  Return Value: Returns _true _if the Live Chat / In-App Messaging 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 Webex Connect 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:

ParametersTypeDescription
messageICMessage The message to send to the Webex Connect platform.
callbackICPublishMessageCallbackInvoked 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)

ParametersTypeDescription
listenerICMessagingListenerListener 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:

ParameterTypeDescription
transactionIdStringThe transaction id of the message whose status should be set as read. See ICMessage.getTransactionId()
callbackICSetMessageStatusCallbackInvoked 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]((https://developers.imiconnect.io/docs/callbacks-1#icsetmessagestatuscallback).

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

  Parameters:

ParameterTypeDescription
transactionIdsString []An array of message transaction ids whose status should be set to Read.
callbackICSetMessageStatusCallbackInvoked 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:

ParameterTypeDescription
messageStoreICMessageStorePass 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.

It provides a means to shut down the messaging module and perform the cleanup. There is normally no need to call this method.

Syntax: void shutdown()

shutdown

It provides a means to shut down the messaging module and perform the cleanup. There is normally no need to call this method.

Syntax: void shutdown(ICShutdownCallback callback)

  Parameters:

ParameterTypeDescription
callbackICShutdownCallbackInvoked 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:

ParameterTypeDescription
topicIdStringThe topic to which the user should be subscribed.
callbackICSubscribeTopicCallbackInvoked 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)

ParametersTypeDescription
listenerICMessagingListenerThe 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:

ParameterTypeDescription
topicIdStringThe topic from which the user should be unsubscribed.
callbackICUnsubscribeTopicCallbackInvoked 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 Webex Connect platform.

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

  Parameters:

ParameterTypeDescription
threadICThreadThe thread instance whose data will be sent to the Webex Connect platform.
callbackICUpdateThreadCallbackInvoked to notify the result of the operation. If an error occurs then the exception parameter will not be null.

processPushData

This method is called to handle push message received from Webex Connect platform.

Syntax:  void processPushData(Map<String,String> data) throws ICException

Parameters:

ParameterTypeDescription
dataMap<String,String>The message data map.

📘

Note

This method call required only if application developer implements their own FirebaseMessagingService and requires connect SDK to process the push message received from connect platform.

try 
{ 
   ICMessaging.getInstance().processPushData(remoteMessage.getData()); 
} 
catch (ICException exception) 
{ 
     Log.e("processPushData", exception.getLocalizedMessage(), exception); 
}

isConnectPushData

This helper method returns whether the message is from the Webex Connect platform or not.

Syntax:  void isConnectPushData(Map<String,String> data)

Parameters:

ParameterTypeDescription
dataMap<String,String>The message data map.

Return Value: Returns true if the message is from Webex Connect platform false otherwise.

processPushToken

This method processes the received Push token from the application.

Syntax: public static void processPushToken(context, token) throws ICException

Throws an ICException if a user is not registered with Webex Connect or if Push feature is not enabled.

Parameters:

ParameterTypeDescription
contextContextSpecifies the Android context.
tokenStringThe token string to be processed.
  try {
      ICMessaging.getInstance().processPushToken(getApplicationContext(), token);
 } catch (ICException e) {                        
      Log.e("processPushToken", e.getLocalizedMessage(), e);
 }

📘

Note:

This method call required only if application developer implements their own FirebaseMessagingService and requires to receive push messages from the Webex Connect platform.

processPushToken (Deprecated)

This method is called to handle the new push registration token.

  Syntax: public void processPushToken() throws ICException

  Example:

try 
{ 
   ICMessaging.getInstance().processPushToken(); 
} 
catch (ICException e) 
{ 

   Log.e("processPushToken", exception.getLocalizedMessage(), exception); 

}

📘

This method call is required only if application developer implements their own FirebaseMessagingService and requires to receive push messages from connect platform.

getPushToken

This method is called to gets the current device push token.

Syntax: public static String getPushToken()

String pushToken = ICMessaging.getPushToken();

addPushTokenListener

This method allows you to add an object which implements the ICPushTokenListener interface to listen for updated token.

  Syntax: public static void addPushTokenListener(final ICPushTokenListener listener)

ParameterTypeDecription
listenerICPushTokenListenerPush token listener
ICMessaging.addPushTokenListener(new ICPushTokenListener()
{
   @Override
   public void onNewPushToken(final String pushToken)
   {
      Log.d(TAG, "onNewPushToken(): " + pushToken);
   }
});

removePushTokenListener

This method allows the developer to remove a previously added object which implements the ICPushTokenListener interface, in order to stop listening for updated token.

  Syntax: public static void removePushTokenListener(final ICPushTokenListener listener)

ParameterTypeDecription
listenerICPushTokenListenerPush token listener

RequestNotificationPermission

Requests the system notification permission prompt to enable notifications display on Android 13 devices. This permission required for apps that target Android API level 33 to allow an app to post notifications

Syntax: public void requestNotificationPermission(boolean openSettings)

ParameterDescription
openSettingsTrue to display a dialog to direct users to the App's notification settings if they have declined permission before

RequestNotificationPermission

Requests the system notification permission prompt to enable notifications display on Android 13 devices. This permission required for apps that target Android API level 33 to allow an app to post notifications

Syntax: public void requestNotificationPermission(boolean openSettings, ICNotificationPermissionCallBack callback)

Parameters: 

ParametersDescription
openSettingsTrue to display a dialog to direct users to the App's notification settings if they have declined permission before.
callbackInvoked when the user accepts or declines the notification permission prompt.

sendClickedEvent

This method sends a click event to the messaging manager for the selected button and with the transaction id.

Syntax:  void sendClickedEvent(final String messageTransactionId, final ICButton icButton, final ICSetMessageStatusCallback callback)

Parameters: 

ParameterTypeDescription
messageTransactionIdStringThe transactionId of the message
icButtonICButtonThe interacted ICButton for which an ICMessage is created

fetchThread

This method fetches the thread object for the threadID. Results are reported through ICFetchThreadCallback.

Syntax:  public void fetchThread(final String threadId, final ICFetchThreadCallback callback)

Parameters:

ParameterTypeDescription
threadIdStringSpecifies the value of ThreadId.
callbackICFetchThreadCallbackInvoked to report the result of the operation.

Sample Code:

ICMessaging.getInstance().fetchThread(threadId, new ICFetchThreadCallback() 
   { 
     @Override 
     public void onFetchThreadComplete(ICThread thread, ICException exception) { 
       if (exception != null) 
       { 
         Log.e("fetchThread", "fetchThread failed! Reason:" + exception.toString()); 
         return; 
       } 
  Log.d("fetchThread", "fetchThread success:"); 
 }
});