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    API Reference

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 the exception of 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 curren-tly 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.

void

publishEvent(Bundle eventParams, ICPublishEventCallback callback)
Invoke publishEvent to publish your custom events info to 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 a 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 effects 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 clean up 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 in line 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!");
      }
    }
  });

publishEvent


Invoke publishEvent to publish your custom events info to the IMIconnect platform.

  Syntax: void publishEvent(Bundle eventParams, ICPublishEventCallback callback)

  Parameters:

Paremeters
Type
Description

eventParams

Bundle

Your custom events input.

callback

ICPublishEventCallback

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

  Example:

Bundle bundle = new Bundle();
bundle.putString("number", "9123443212");
bundle.putString("OTP", "234642");
IMIconnect.publishEvent(bundle, new ICPublishEventCallback()
{
   @Override
   public void onPublishEventComplete(final Bundle bundle, final ICException exception)
   {
      if (exception != null)
      {
         Log.e(TAG, "Publish failed", exception);
         return;
      }
      Log.d(TAG, "Published successfully");
   }
});

Updated about a month ago

IMIconnect


Suggested Edits are limited on API Reference Pages

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