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

This section details the classes which facilitate SDK initialization, registration and the logging system

This section details the classes which facilitate SDK initialization, registration and the logging system:

IMIconnect

This class is used to initialize the SDK and manage user registration. When integrating the SDK into your app it is mandatory to use this class to initialize the SDK before any other features are used. With exception to the Authentication module, it is also necessary to register a user before other features are used.

Return Type
Method

String

getDeviceId()
Returns the device-Id passed during registration.


getDeviceProfile()
Returns the device profile that is currently registered with the SDK. Returns null if no device is currently registered.


long

getPolicyPollingInterval()
Returns the interval, in minutes, at which the SDK will poll for policy updates.


String

getSDKVersion()
Returns the SDK build version.


boolean

isRegistered()
Returns true if the device is registered, otherwise returns false.


boolean

isStarted()
Returns true if the SDK is started, otherwise returns false.


void

register(final ICDeviceProfile deviceProfile, ICRegistrationCallback callback)
Registers the provided device profile with the IMIconnect platform.


void

registerListener(ICSecurityTokenExceptionListener listener)
Registers an ICSecurityTokenExceptionListener that will be notified when Security Token related exceptions occur.


void

removeProfileData(ICDeviceProfileParam param, ICUpdateProfileDataCallback callback)
Removes a parameter of the current device profile from the IMIconnect platform.


void

setPolicyPollingInterval(int intervalMinutes)
Used to set the interval, in minutes, at which the SDK will poll for policy updates.


void

setSecurityToken(String token)
Used to specify a Security Token that the SDK will pass to the IMIconnect platform for all user centric API requests.


void

shutdown() - Deprecated
Please use shutdown(ICShutdownCallback) instead.


void

shutdown(ICShutdownCallback callback)
Used to cleanup internal resources used by the SDK.


void

startup(Context context)
Initializes the SDK by reading configuration data from the application manifest.


void

startup(Context context, ICConfig config)
Initializes the SDK by using the ICConfing object "config" that is to be defined by the developer.


void

unregister(ICRegistrationCallback)Unregisters the current device profile from the IMIconnect platform.


void

unregisterListener(ICSecurityTokenExceptionListener listener)
Unregisters a previously registered ICSecurityTokenExceptionListener instance.


void

updateProfileData(ICDeviceProfileParam param, String value, ICUpdateProfileDataCallback callback)
Updates a parameter of the current device profile within the IMIconnect platform.

getDeviceId


Returns the deviceId passed during registration.

  Syntax: String getDeviceId()

getDeviceProfile


Returns the device profile that is currently registered with the SDK. Returns null if no device is currently registered.

  Syntax: static ICDeviceProfile getDeviceProfile()

getPolicyPollingInterval


Returns the current policy polling interval in minutes.

  Syntax: int getPolicyPollingInterval()

  Returns:
   The policy polling interval in minutes.

getSDKVersion


Returns the SDK build version.

  Syntax: public String getSDKVersion()

  Return value: SDK build version.

isRegistered


Used to determine if the device is currently registered with IMIconnect.

  Syntax: boolean isRegistered()

  Returns:
   true if the device is registered, otherwise false.

isStarted


Used to determine if the SDK is currently started.

  Syntax: public boolean isStarted()

  Returs: true if the SDK is started, otherwise false.

register


Registers the provided device profile with the IMIconnect platform.

  Syntax: void register(final ICDeviceProfile deviceProfile, final ICRegistrationCallback callback)

  Parameters:

Parameters
Type
Description

deviceProfile

The device profile to register

callback

Invoked on registration success or failure

  Example:

IMIconnect.register(new ICDeviceProfile(ICDeviceProfile.getDefaultDeviceId()), new ICRegistrationCallback()
{
  @Override
  public void onRegistrationComplete(final Bundle bundle, final ICException exception)
  {
    if (exception != null) 
    {
      Log.e("Registration", "Registration failed! Reason:" + exception.toString());
    } 
    else 
    {
      Log.d("Registration", "Registration succeeded!");
    }
  }
});

ICDeviceProfile contains a second constructor variant that allows you to specify a user id in addition to a device id. When a user id is not supplied, the IMIconnect platform will generate one, the generated value may be obtained by querying the ICDeviceProfile after successful registration.

registerListener


Registers an ICSecurityTokenExceptionListener that will be notified when Security Token related exceptions occur.

  Syntax: void registerListener(ICSecurityTokenExceptionListener listener)

  Parameters:

Parameter
Type
Description

listener

Security Token exception listener.

  Example:

IMIconnect.registerListener(new ICSecurityTokenExceptionListener(){
  @Override
  public void onException(final ICException e)
  {
    switch (e.getErrorCode())
    {
      case TokenInvalid:
        // Token is invalid, regenerate 
      case TokenExpired:
        // Token has expired, regenerate 
      case TokenRequired:
				// Token is required, generate
						
        // Generate the token and pass back to the SDK
        // via IMIconnect.setSecurityToken(generatedToken);
    }
  }
});

removeProfileData


Removes a parameter of the current device profile from the IMIconnect platform.

  Syntax: void removeProfileData(ICDeviceProfileParam param, final ICUpdateProfileDataCallback callback)

  Parameters:

Parameters
Type
Description

param

The ICDeviceProfileParam representing the parameter data which should be removed.

callback

The callback through which the result of the operation is notified.

  Example:

IMIconnect.removeProfileData(ICDeviceProfileParam.CustomerId, new ICUpdateProfileDataCallback()
{
  @Override
  public void onUpdateComplete(final Bundle bundle, final ICException exception)
  {
    if (exception != null) 
    {
      Log.e("removeProfileData", " removeProfileData for userId failed! Reason:" + exception.toString());
    } 
    else 
    {
      Log.d("removeProfileData", " removeProfileData for userId succeeded!");
    }
  }
});

setPolicyPollingInterval


Used to set the interval, in minutes, at which the SDK will poll for policy updates. To prevent adverse affects on battery or CPU usage a minimum interval of 30 minutes is enforced.

  Syntax: void setPolicyPollingInterval(int intervalMinutes)

  Parameters:

Parameter
Type
Description

intervalMinutes

Integer

Specifies how the SDK will poll for policy updates.

The default value is 30 minutes.

To disable polling set the value to 0.

Polling only applies where both Push and In App Messaging are not enabled.

setSecurityToken


Used to specify a Security Token that the SDK will pass to the IMIconnect platform for all user centric API requests. The platform will validate the token before processing requests.

  Syntax: void setSecurityToken(String token)

shutdown


  Syntax: void shutdown()

Deprecated - Please use shutdown(ICShutdownCallback) instead.

shutdown


Used to cleanup internal resources used by the SDK. Invoking this method will stop all SDK features from functioning, In app messages will no longer be received and Push notifications will no longer be handled.

ensp; Syntax: public void shutdown(final ICShutdownCallback callback)

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

Normally usage of this method is not required, there are a few limited cases where you may wish to use it, such as if you are only using the Authentication or Monitoring features.

startup


Initializes the SDK by reading configuration data from the application manifest.

  Syntax: void startup(Context context)

  Parameters:

Parameter
Type
Description

context

Specifies the Android context.

  Example:

public class MyApplication extends Application 
{
  @Override
  public void onCreate() 
  {
    super.onCreate();
    // Initialize the IMIconnect SDK , reads the configuration from app manifest
    try 
    {
      IMIconnect.startup(this);
    } 
    catch (ICException e) 
    {
      e.printStackTrace();
    }
  }
}
<application
   android:name="YOUR_APP_NAME"
   android:allowBackup="true"
   android:label="@string/app_name"
   android:theme="@style/AppTheme">

   <!-- Meta data needed for application identification -->
   <!-- Add the app id generated from IMIconnect -->
   <meta-data
       android:name="appid"
       android:value="@string/app_id"/>

   <!-- Add the client key generated from IMIconnect -->
   <meta-data
       android:name="clientkey"
       android:value="@string/client_key"/>

   <!-- Meta data needed for your Google GCM Project number -->
   <meta-data
       android:name="projectnumber"
       android:value="@string/project_number"/>
  
</application>

Note

The startup method must be called from Application.onCreate so that the SDK is initialized inline with the lifecycle of the host application.

startup

Initializes the SDK by using the ICConfing object "config" that is to be defined by the developer.
  
Syntax: void startup(Context context, ICConfig config)

  Parameters:

Parameter
Type
Description

context

Specifies the Android context.

config

An ICConfig instance containing valid app credentials.

  Example:

public class MyApplication extends Application 
{
  @Override
  public void onCreate() 
  {
    super.onCreate();

    try 
    {
    //Initialize an ICConfig instance with an appId and clientKey.
    ICConfig config = new ICConfig(appId, clientKey);
    // Initialize the IMIconnect SDK with ICConfig instance
    IMIconnect.startup(this, config);
    } 
    catch (ICException e) 
    {
      e.printStackTrace();
    }
  }
}

unregister


Unregisters the current device profile from the IMIconnect platform. On successful completion, Push and In-App Messages will no longer be received on the device.

  Syntax: void unregister(final ICRegistrationCallback callback)

  Parameters:

Parameters
Type
Description

callback

Invoked to report operation success or failure

unregisterListener


Unregisters a previously registered ICSecurityTokenExceptionListener instance. The instance will no longer receive Security Token exceptions.

  Syntax: unregisterListener(ICSecurityTokenExceptionListener listener)

  Parameters:

Parameter
Type
Description

listener

Security Token exception listener.

updateProfileData


Updates a parameter of the current device profile within the IMIconnect platform.

  Syntax: void updateProfileData(ICDeviceProfileParam param, final String value, final ICUpdateProfileDataCallback callback)

  Parameters:

Parameters
Type
Description

param

An ICDeviceProfileParam indicating the parameter which should be updated.

value

String

A String containing the data value.

callback

A callback through which the result of the operation is notified.

  Example:

IMIconnect.updateProfileData(ICDeviceProfileParam.CustomerId, customerIdValue, new ICUpdateProfileDataCallback()
  {
  @Override
  public void onUpdateComplete(final Bundle bundle, final ICException exception)
    {
      if (exception != null) 
      {
        Log.e("updateProfileData", "updateProfileData for customerId failed! Reason:" + exception.toString());
      } 
      else 
      {
        Log.d("updateProfileData", "updateProfileData for customerId succeeded!");
      }
    }
  });

ICConfig

This class holds configuration information that is used to initialize the SDK.

Public Methods

Return Type
Method

String

String

getProjectNumber() - Deprecated

ICConfig


This method is used to initialize an ICConfig instance with an appId and clientKey.

  Syntax: ICConfig(String appId, String clientKey)

  Parameters:

Parameter
Type
Description

appId

String

The app id that is generated while creating an app asset within IMIconnect.

clientKey

String

The client key that is generated while creating an app asset within IMIconnect.

ICConfig


Deprecated - Please use ICConfig instead.

This method is used to initialize ICConfig instance with an appId, clientKey, and projectNumber.

  Syntax: ICConfig(String appId, String clientKey, String projectNumber)

  Parameters:

Parameter
Type
Description

appid

String

The app id that is generated while creating an app asset within IMIconnect.

clientKey

String

The client key that is generated while creating an app asset within IMIconnect.

projectNumber

String

The GCM project number relating to your mobile app.

getAppId


Returns the app id.

  Syntax: String getAppId()

  Return Value:
  Returns the appid.

getClientKey


Returns the client key.

  Syntax: String getClientKey()

  Return Value:
  Returns the client key.

getProjectNumber


Deprecated - The project number value is no longer used by IMIconnect.

Returns the project number.

  Syntax: String getProjectNumber()

  Return Value:
  Returns the project number.

ICDeviceProfile

Holds information about a device and associated user data. Device profiles are registered with the IMIconnect platform to allow targeted communication between the platform and the SDK.

If a device profile is registered without providing a specific appUserId value, the IMIconnect platform will generate one automatically. The currently registered device profile is accessible via IMIconnect.getDeviceProfile().

Note

We recommend using an Instance ID or UUID for your deviceId, the defaultDeviceId is provided as a convenience and uses the standard ANDROID_ID value.

Public Methods

Return Type
Method

String

getAppUserId()
Returns the app user id.


String

getCustomerId()
This method is used to get the Customer ID.


String

getDefaultDeviceId()
Convenient method for obtaining a device id.


String

getDeviceId()
Returns the device id.


boolean

isAppUserSystemGenerated()
Returns true if userId is generated by IMIconnect system, otherwise false.

ICDeviceProfile


Creates an ICDeviceProfile instance with the given deviceId and appUserId.

  Syntax: ICDeviceProfile(final String deviceId)

  Parameters

Parameter
Type
Description

deviceId

String

A unique identifier for the device

ICDeviceProfile


Creates an ICDeviceProfile instance with the given deviceId and appUserId.

  Syntax: ICDeviceProfile(final String deviceId, final String appUserId)

  Parameters

Parameter
Type
Description

deviceId

String

A unique identifier for the device

appUserId

String

A unique identifier representing the device user

getAppUserId


Returns the app user id.

  Syntax: String getAppUserId()

  Return Value: Returns the app user id. If an id was not specified when constructing the ICDeviceProfile instance, then returns the id generated by the IMIconnect platform during registration.

getCustomerId


This method is used to get the Customer ID.
  Syntax: String getCustomerId()

  Return Value: Returns the customerId associated to the device profile. It must be previously associated by calling the updateProfileData method.

getDefaultDeviceId


Convenient method for obtaining a device id. The id returned is equivalent to Settings.Secure.ANDROID_ID

  Syntax: public static String getDefaultDeviceId()

  Returns: A default deviceId equivalent to Settings.Secure.ANDROID_ID.

getDeviceId


Returns the device id.

  Syntax: String getDeviceId()

  Return Value: Returns the device identifier.

isAppUserSystemGenerated


Used to determine if the current appUserId value was generated by the IMIconnect platform.

  Syntax: boolean isAppUserSystemGenerated()

  Return Value: Returns true if userId is generated by IMIconnect system, otherwise false.

ICLogger

Allows control of the internal logging system.

The SDK logging system can output information that can help identify operational issues, there are two levels of information, a minimal set for production builds and a more verbose set intended for development builds.

Public Methods

Return Type
Method

File

getOutputLocation()
This method returns the default output location.


void

setLogOptions(ICLogType logType, ICLogTarget logTarget)
This method sets the log options for the logger.


getOutputLocation


This method returns the default output location.

  Return value: Returns absolute directory.

setLogOptions


This method sets the log options for the logger.

  Syntax: void setLogOptions(ICLogType logType, ICLogTarget target)

  Parameters:

Parameter
Type
Description

logType

ICLogType

The type of logs that will be logged.

target

ICLogTarget

The target on which the logs will be displayed/recorded.

setRetentionDuration


This method sets the retention duration of the logs. The logs will be kept during that duration and will be automatically purged after.

  Syntax: void setRetentionDuration(int days)

  Parameters:

Parameter
Type
Description

days

Integer

Number of days after which the logs will be purged.

startup


This method is used to Initialize the logging system.

  Syntax: void startup(Context context)

  Parameters:

Parameter
Type
Description

context

Context

Specifies the Android context.

ICConstants

This class contains all constants which are exposed outside of the SDK.

Modifier and Type
Field
Description

String

BUNDLE_EXTRA_APP_USER_ID

Constant used for retrieving the userId from Bundle data from registration response callback

String

DEFAULT_CHANNEL_ID

The default Notification channelId used by Connect platform to display notifications.

String

INTENT_ACTION_NOTIFICATION_CLICK

Intent action for Notification action click.

Core


This section details the classes which facilitate SDK initialization, registration and the logging system

Suggested Edits are limited on API Reference Pages

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