Callbacks

This section details the callback and listener interfaces contained within the com.imimobile.connect.core.callbacks package.

ICCreateThreadCallback

Used to receive the result of calls to the asynchronous ICMessaging.createThread method.

onCreateThreadComplete

Invoked when the ICMessaging.createThread method completes execution. If an error occurs the exception parameter will not be null.

  Syntax: void onCreateThreadComplete(ICThread thread, ICException exception);

  Parameters:

Parameter

Type

Description

thread

ICThread

The thread object that was provisioned within the Webex Connect platform.

exception

ICException

Null if the operation succeeded.

ICFetchMessagesCallback

Used to receive the result of calls to the asynchronous ICMessaging.fetchMessages method.

onFetchMessagesComplete

Invoked when the ICMessaging.fetchMessages completes execution. If an error occurs then the exception parameter will not be null.

  Syntax: onFetchMessagesComplete(ICMessage[] messages, boolean hasMoreData, ICException exception);

  Parameters:

Parameter

Type

Description

messages

ICMessage

The fetched messages array

hasMoreData

boolean

A value of true signifies that additional messages exist within the platform that matched the initial fetch criteria.

exception

ICException

Null if the operation succeeded.

ICFetchStreamsCallback

Removed since v2.7.0.

Used to receive the result of the asynchronous ICMessaging.fetchStreams method.

onFetchStreamsComplete

Invoked when calls to the ICMessaging.fetchStreams method completes execution. If an error occurs, then the exception parameter will not be null.

  Syntax: void onFetchStreamsComplete(ICStream[] streams, ICException exception);

  Parameters:

Parameter

Type

Description

streams

ICStream[]

Array of streams fetched from the Webex Connect platform.

exception

ICException

Null if the operation succeeds.

ICFetchThreadsCallback

Used to receive the result of the asynchronous ICMessaging.fetchThreads method.

onFetchThreadsComplete

Invoked when execution of ICMessaging.fetchThreads completes. If an error occurs then the exception parameter will not be null.

  Syntax: void onFetchThreadsComplete(ICThread[] threads, boolean hasMoreData, ICException exception);

  Parameters:

Parameter

Type

Description

threads

ICThread

Array of threads fetched from the Webex Connect platform.

hasMoreData

boolean

A value of true signifies that additional threads exist within the platform that matched the initial fetch criteria.

exception

ICException

Null if the operation was successful.

ICFetchTopicsCallback

Used to receive the result of the asynchronous ICMessaging.fetchTopics method.

onFetchTopicsComplete


Invoked when execution of ICMessaging.fetchTopics is complete. If an error occurs, then the exception parameter will be non-null.

  Syntax: void onFetchTopicsComplete(ICTopic[] topics, boolean hasMoreData, ICException exception)

  Parameters:

Parameter

Type

Description

topics

ICTopic

Array of topics fetched from the platform.

hasMoreData

boolean

A value of true signifies that additional threads exist within the platform that matched the initial fetch criteria.

exception

ICException

Null if the operation was successful.

ICFileDownloadCallback

Used when downloading files with ICMediaFileManager to receive events related to progress and completion.

onFileDownloadComplete


Invoked when a download completes or has failed.

  Syntax: onFileDownloadComplete(URL url, File file, ICException exception)

  Parameters:

Parameter

Type

Description

url

URL

The URL of the download.

file

File

The downloaded file. Null if an error occurred.

exception

ICException

Non-null if an error occurred.

onFileDownloadProgress


Invoked to report the progress of a download operation.

  Syntax: onFileDownloadProgress(URL url, long bytesDownloaded, long bytesTotal)
Parameters:

Parameter

Type

Description

url

URL

The URL of the download.

bytesDownloaded

long

The number of bytes that have been downloaded so far.

bytesTotal

long

The total number of bytes for the download.

ICFileUploadCallback

Used when uploading files with ICMediaFileManager to receive events related to progress and completion.

onFileUploadComplete


Invoked when upload completes or has failed.

  Syntax: onFileUploadComplete(File file, String mediaId, ICException exception)

  Parameters:

Parameter

Type

Description

file

File

The local file that was uploaded.

mediaId

String

The identifier of the upload within the Webex Connect platform. Will be null if the upload failed.

exception

ICException

Non-null if an error occurred during upload.

onFileUploadProgress


Invoked to report the progress of a file upload operation.

  Syntax: onFileUploadProgress(File file, long bytesUploaded, long bytesTotal)

  Parameters:

Parameter

Type

Descriptio

file

File

The local file that is being uploaded.

bytesUploaded

long

The number of bytes that have been uploaded so far.

bytesTotal

long

The total number of bytes for the upload operation.

ICMessagingListener

Interface for listening to events from the ICMessaging class.

onConnectionStatusChanged

Invoked when there is a change to the In-App Messaging connection status. If an error has occurred (status == .Error) the exception parameter will be non-null.

  Syntax: void onConnectionStatusChanged(ICConnectionStatus status, ICException exception) .

Parameter

Parameter

Type

Description

status

ICConnectionStatus

The current connection status.

exception

ICException

Non-null if an error has occurred.

onMessageReceived

Invoked when a new In-App Message is received from the Webex Connect platform.

  Syntax: void onMessageReceived(ICMessage message).

Parameter

Parameter

Type

Description

message

ICMessage

The received message.

ICPublishMessageCallback

Used to receive the result of messages published via ICMessaging.publishMessage.

onPublishMessageComplete


Invoked to report the result of publishing an In-App Message. If an error occurs then the exception parameter will not be null.

  Syntax: void onPublishMessageComplete(ICMessage message, ICException exception)

  Parameters:

Parameter

Type

Description

message

ICMessage

The message that was being published.

exception

ICException

Non-null if an exception occurred.

ICRegistrationCallback

Used to receive the result of calls to imiconnect.register.

onRegistrationComplete


Invoked to report the result of user registration. If an error occurs then the exception parameter will not be null.

The bundle parameter is reserved for future use to return registration-related information.

  Syntax: void onRegistrationComplete(Bundle bundle, ICException exception)

  Parameters:

Parameter

Type

Description

bundle

Bundle

Reserved for future use.

exception

ICException

Non-null if an exception occurs.

ICSecurityTokenExceptionListener

Used for listening to Security Token exceptions that occur from API calls to the Webex Connect Platform.

onException

Invoked whenever a Security Token exception occurs, the ICException object contains cause information.

  Syntax: void onException(ICException exception)

  Parameters:

Parameter

Type

Description

exception

ICException

Describes the cause of the error.

ICSetMessageStatusCallback

Used to receive the result of message status updates for ICMessaging.setMessageAsRead and ICMessaging.setMessagesAsRead.

onSetMessageStatusComplete


Invoked to report the result of updating message statuses. If an error occurs then the exception parameter will be non-null.

  Syntax: void onSetMessageStatusComplete(String[] messageTransactionIds, ICException exception)

  Parameters:

Parameter

Type

Description

messageTransactionIds

String[]

An array of messages ids on which the operation was performed.

exception

ICException

Null if the operation succeeded.

ICStartupCallback

This interface contains a single method that is used to notify the caller when the SDK startup is complete.

If the startup failed the ICException parameter will be non-null and contains details of the failure.

public interface ICStartupCallback 

{ 

  void onStartupComplete(ICException e); 

}

ICShutdownCallback

This interface contains a single method that is used to notify the caller when the SDK shutdown is complete.

If the startup failed the ICException parameter will be non-null and contains details of the failure.

public interface ICShutdownCallback 

{ 

  void onShutdownComplete(final ICException e); 

}

Return Type

Method

void

onShutdownComplete()

onShutdownComplete


Invoked when the shutdown is complete.

  Syntax: void onShutdownComplete()

ICSubscribeTopicCallback

Used to receive the result of topic subscription operations made via ICMessaging.subscribeTopic.

onSubscribeTopicComplete


Invoked to report the result of the topic subscription. If the operation succeeds then the exception parameter will be null.

  Syntax: void onSubscribeTopicComplete(String topicId, ICException exception)

  Parameters:

Parameter

Type

Description

topicId

String

The id of the topic for the subscription operation.

exception

ICException

Null if the operation succeeded.

ICUnsubscribeTopicCallback

Used to receive the result of calls to ICMessaging.unsubscribeTopic.

onUnsubscribeTopicComplete


Invoked to report the result of unsubscribing from a topic. If the operation succeeds, the exception parameter will be null.

  Syntax: void onUnsubscribeTopicComplete(String topicId, ICException exception)

  Parameters:

Parameter

Type

Description

topicId

String

The id of the topic which was being unsubscribed.

exception

ICException

Null if the operation succeeded.

ICUpdateProfileDataCallback

Used to receive the result of profile update operations made via imiconnect.updateProfileData

onUpdateComplete


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

  Syntax: void onUpdateComplete(Bundle bundle, ICException exception)

  Parameters:

Parameter

Type

Description

bundle

Bundle

Reserved for future use.

exception

ICException

Null if the operation succeeded.

ICUpdateThreadCallback

Used to receive the result of calls to ICMessaging.updateThread and ICMessaging.closeThread

onUpdateThreadComplete

Invoked when the operation completes. If the call was successful the exception parameter will be null.

  Syntax: void onUpdateThreadComplete(ICThread thread, ICException exception);

  Parameters:

Parameter

Type

Description

thread

ICThread

The thread instance that was being updated / closed.

exception

ICException

Null if the operation succeeded.

ICUserAuthenticationCallback

Captures events raised during the various stages of user authentication.

onPinGenerated


Invoked when a pin code has been successfully generated by the Webex Connect platform, in response to a call of ICUserAuthentication.generatePin.

  Syntax: void onPinGenerated()

onPinValidated

Invoked when a pin code has been successfully validated. This may occur in response to ICUserAuthentication.validatePin or after automatic pin validation from an incoming SMS when the SDK is in listening mode.

  Syntax: void onPinValidated()

onPinReceived

Invoked when a pin has been received. This event is only raised when the SDK is listening for incoming SMS.

  Syntax: void onPinReceived()

onError


Invoked if any stage of the authentication process has failed.

  Syntax: void onError(ICException exception)

  Parameters:

Parameter

Type

Description

exception

ICException

Contains error information.

ICPublishEventCallback

Used to receive the result of messages published via imiconnect.publishEvent.

onPublishEventComplete

Invoked to report the result of publishing events. If an error occurs then the exception parameter will not be null.

  Syntax: void onPublishEventComplete(Bundle bundle, ICException exception)

  Parameters:

Parameter

Type

Description

bundle

Bundle

The events being published.

exception

ICException

Non-null if an exception occurred.

ICDeleteMessageCallback

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

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:

Parameter

Type

Description

messageTransactionId

String

Message’s transaction id

exception

ICException

Null if the operation succeeded.

ICPushTokenListener

Used for listening to the updated push token.

Return Type

Method

void

onNewToken(String token)

onNewToken

Called when a new token for the default Firebase project is generated.

  Syntax: public void onNewToken(String token)

  Parameters:

Parameter

Type

Description

token

String

New push token

ICRegenerateMediaURLCallback

Used to receive the result of calls to the asynchronous ICMediaFileManager. regenerateMediaURL method.

onRegenerateMediaURLComplete

Invoked when regenerate media URL is completed/failed.

Syntax:   void onRegenerateMediaURLComplete(URL url, ICException exception)

Parameter

Type

Description

url

URL

Media url

exception

ICException

Non-null if an error occurred.

ICNotificationPermissionCallBack

Used to receive the result of the asynchronous ICMessaging.requestNotificationPermission method

onComplete

Invoked to report the result, when the user accepts or declines the notification permission prompt

Syntax : void onComplete(boolean isGranted)

Parameter

Descriptions

isGranted

A value of true signifies that user accepted the notification permission otherwise not