Upgrade the in-app plug-in with version of the Android SDK

In, the Mobile app messaging SDK uses the SQLite database implementation for in-app messages. Earlier releases used the Realm database.

By using the SQLite database implementation, Mobile App Messaging reduces the apparent size of the app in the Google Play store by up to 3 MB.

How it affects you

Based on how you are currently using in-app messaging, you must decide what to do with messages in the Realm database. Consider the following cases.

Case 1 – You are not using in-app messages.

You are not affected by the move the to the SQLite implementation. If you choose to integrate in-app messages in the future, the messages use the SQLite database and benefit from the smaller app size.

Case 2 – You don’t want to reuse in-app messages that were sent in an earlier release (or messages that expired).

In this case, delete the Realm database but do not migrate existing messages. When you integrate the new in-app plug-in, remove the Realm dependencies in your module’s build.gradle:




Next, delete the Realm database, if it exists, in your startup code. Use the application class’s onCreate method:

import java.io.File;


    File realmFile = new File(getApplicationContext().getFilesDir(),"mce-inapp.realm");

    if(realmFile.exists()) {



Case 3 – You want to reuse in-app messages that were sent in an earlier release.

Migrate the Realm messages to the SQLite database by integrating the Realm migration code for at least one app release. To complete the move to SQLite and take advantage of the reduced size of the SQLite database, wait to a later release to remove the Realm migration code.

To integrate the Realm migration code, ensure that you include the Realm dependencies in your module’s build.gradle. The Realm dependencies should already be present from a previous release of the SDK:




The migration from Realm happens automatically when the app receives or displays an in-app message.

To force the migration, call:

InAppManager.checkMigration(getContext());To start the migration

Subsequent calls to checkMigration do nothing.

After most of your users migrate their messages, you can release a second version of the app without the Realm dependencies. For instructions, see Case 2.

For more information about in-app messages, see Create and send an in-app message.