All Products
Search
Document Center

Mobile Platform as a Service:Advanced guide

Last Updated:Jan 26, 2026

After you integrate the SDK, you can configure an upgrade whitelist, check for upgrades, and prompt users as needed.

Set a whitelist

Set the user ID for the whitelist as follows:

MPLogger.setUserId("your_whitelist_id");

Check for new versions

  • To quickly check for a new version and display a pop-up notification:

    Note

    This method only displays a quick upgrade pop-up and does not include forced upgrade logic. To force an upgrade, you must implement a custom upgrade.

      MPUpgrade mMPUpgrade = new MPUpgrade();
      mMPUpgrade.fastCheckNewVersion(activity, drawable);
  • To quickly check for a new version and only return the check result:

      MPUpgrade mMPUpgrade = new MPUpgrade();
      // Synchronous method. Call it in a subthread.
      int result = mMPUpgrade.fastCheckHasNewVersion();
      if (result == UpgradeConstants.HAS_NEW_VERSION) {
        // A new version is available.
      } else if (result == UpgradeConstants.HAS_NO_NEW_VERSION) {
        // No new version is available.
      } else if (result == UpgradeConstants.HAS_SOME_ERROR) {
        // An error occurred.
      }

Get detailed upgrade information

Call the fastGetClientUpgradeRes method to obtain more details:

MPUpgrade mMPUpgrade = new MPUpgrade();
// Synchronous method. Call it in a subthread.
ClientUpgradeRes clientUpgradeRes = mMPUpgrade.fastGetClientUpgradeRes();

The response contains information such as the new version number and download URL. The following list describes some of the parameters:

  • downloadURL: The download URL.

  • guideMemo: The upgrade information.

  • newestVersion: The latest version.

  • resultStatus: The upgrade mode.

    • 202 indicates a one-time reminder.

    • 204 indicates multiple reminders.

    • 203/206 indicates a forced upgrade.

  • fileSize: The size of the file to be downloaded.

Other custom checks

For more customization options, see the following examples:

  • You can implement the MPaaSCheckCallBack interface to respond to requests from the upgrade SDK, such as displaying a pop-up dialog box:

      MPUpgrade mMPUpgrade = new MPUpgrade();
      mMPUpgrade.setUpgradeCallback(new MPaaSCheckVersionService.MPaaSCheckCallBack() {
           .........
      });
  • Call the MPUpgrade.checkNewVersion method to check for upgrade information.

    MPUpgrade encapsulates the call to MPaaSCheckVersionService. You can also create a custom implementation. For more information about MPaaSCheckVersionService and MPaaSCheckCallBack, see the API reference.

Customize the download folder for installation packages (supported in versions 10.1.60 and later)

Configure as follows:

File dir = getApplicationContext().getExternalFilesDir("custom_folder");
MPUpgrade mpUpgrade = new MPUpgrade();
mpUpgrade.setDownloadPath(dir.getAbsolutePath());

In addition, add the following configuration to the file_path.xml file:

// external-files-path corresponds to the folder of getExternalFilesDir.
// Use the element that corresponds to your custom folder. If you are unsure which to choose, search for "Adapt to File Provider".
<external-files-path
  name="download"
  path="custom_folder" />

Customize notifications

MPUpgrade mMPUpgrade = new MPUpgrade();
mMPUpgrade.setShowDefaultNotification(false);// Set to true to show the default download notification, or false to use a custom download notification.

mMPUpgrade.update(clientUpgradeRes, new UpgradeDownloadCallback() {
    @Override
    public void onLoadNotificationConfig(UpgradeDownloadRequest upgradeDownloadRequest) {
        
    }

    @Override
    public void onPrepare(UpgradeDownloadRequest upgradeDownloadRequest) {
        // Create a custom download notification.
    }

    @Override
    public void onProgress(UpgradeDownloadRequest upgradeDownloadRequest, int i) {
        // Update the progress of the notification progress bar chart.
    }

    @Override
    public void onCancel(UpgradeDownloadRequest upgradeDownloadRequest) {

    }

    @Override
    public void onFinish(UpgradeDownloadRequest upgradeDownloadRequest, String s) {

    }

    @Override
    public void onFailed(UpgradeDownloadRequest upgradeDownloadRequest, int i, String s) {

    }
});

Handle package parsing failures after a forced upgrade

On some ROMs, a package parsing failure may occur after a forced upgrade. This failure happens because some ROMs access the application's process during package installation. A forced upgrade terminates this process, which causes the parsing failure. This custom ROM behavior does not comply with standard Android behavior. To resolve this issue, you can set UpgradeForceExitCallback and have needForceExit return false.

  1. Implement the callback.

     public class UpgradeForceExitCallbackImpl implements UpgradeForceExitCallback {
         @Override
         public boolean needForceExit(boolean forceExitApp, MicroApplicationContext context) {
             // If you return false, the process is not forcibly killed, which prevents package parsing failures. If you return true, you must handle the process exit, and the doForceExit method below is called.
             return false;
         }
         @Override
         public void doForceExit(boolean forceExitApp, MicroApplicationContext context) {
             // To shut down the process, needForceExit must return true. Then, shut down the process within this method.
         }
     }
  2. Set the callback.

     MPUpgrade mpUpgrade = new MPUpgrade();
     mpUpgrade.setForceExitCallback(new UpgradeForceExitCallbackImpl());
    Important
    • You must use the same MPUpgrade instance to set the callback and request an upgrade.

    • Setting the callback prevents package parsing failures, but the upgrade component will no longer automatically terminate the process. Therefore, if a user returns to the application instead of tapping Install, you must display a non-cancelable pop-up overlay to prevent the user from bypassing the forced upgrade.