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:

ParameterTypeDescription
threadICThreadThe thread object that was provisioned within the IMIconnect platform.
exceptionICExceptionNull 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:

ParameterTypeDescription
messagesICMessageThe fetched messages array
hasMoreDatabooleanA value of true signifies that additional messages exist within the platform that matched the initial fetch criteria.
exceptionICExceptionNull 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:

ParameterTypeDescription
streamsICStream[]Array of streams fetched from the IMIconnect platform.
exceptionICExceptionNull 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:

ParameterTypeDescription
threadsICThreadArray of threads fetched from the IMIconnect platform.
hasMoreDatabooleanA value of true signifies that additional threads exist within the platform that matched the initial fetch criteria.
exceptionICExceptionNull 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:

ParameterTypeDescription
topicsICTopic[]Array of topics fetched from the platform.
hasMoreDatabooleanA value of true signifies that additional threads exist within the platform that matched the initial fetch criteria.
exceptionICExceptionNull 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:

ParameterTypeDescription
urlURLThe URL of the download.
fileFileThe downloaded file. Null if an error occurred.
exceptionICExceptionNon-null if an error occurred.

onFileDownloadProgress


Invoked to report the progress of a download operation.

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

ParameterTypeDescription
urlURLThe URL of the download.
bytesDownloadedlongThe number of bytes that have been downloaded so far.
bytesTotallongThe 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 an upload completes or has failed.

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

  Parameters:

ParameterTypeDescription
fileFileThe local file that was uploaded.
mediaIdStringThe identifier of the upload within the IMIconnect platform. Will be null if the upload failed.
exceptionICExceptionNon-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:

ParameterTypeDescriptio
fileFileThe local file that is being uploaded.
bytesUploadedlongThe number of bytes that have been uploaded so far.
bytesTotallongThe 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

ParameterTypeDescription
statusICConnectionStatusThe current connection status.
exceptionICExceptionNon-null if an error has occurred.

onMessageReceived

Invoked when a new In App Message is received from the IMIconnect platform.

  Syntax: void onMessageReceived(ICMessage message).

Parameter

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

ParameterTypeDescription
messageICMessageThe message that was being published.
exceptionICExceptionNon-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:

ParameterTypeDescription
bundleBundleReserved for future use.
exceptionICExceptionNon-null if an exception occurs.

ICSecurityTokenExceptionListener

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

onException


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

  Syntax: void onException(ICException exception)

  Parameters:

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

ParameterTypeDescription
messageTransactionIdsString[]An array of messages ids on which the operation was performed.
exceptionICExceptionNull if the operation succeeded.

ICShutdownCallback

Used to determine when SDK shutdown is complete.

Return TypeMethod
voidonShutdownComplete()

onShutdownComplete


Invoked when 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 topic subscription. If the operation succeeds then the exception parameter will be null.

  Syntax: void onSubscribeTopicComplete(String topicId, ICException exception)

  Parameters:

ParameterTypeDescription
topicIdStringThe id of the topic for the subscription operation.
exceptionICExceptionNull 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:

ParameterTypeDescription
topicIdStringThe id of the topic which was being unsubscribed.
exceptionICExceptionNull 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:

ParameterTypeDescription
bundleBundleReserved for future use.
exceptionICExceptionNull 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:

ParameterTypeDescription
threadICThreadThe thread instance that was being updated / closed.
exceptionICExceptionNull 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 IMIconnect 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:

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

ParameterTypeDescription
bundleBundleThe events being published.
exceptionICExceptionNon-null if an exception occurred.