All Products
Search
Document Center

Mobile Platform as a Service:Advanced guide

Last Updated:Jun 15, 2026

Configure an upgrade whitelist, check for new versions, and prompt users to upgrade after SDK integration.

Set a whitelist

Set the whitelist user ID:

MPLogger.setUserId("your_whitelist_id");

Check for new versions

  • Check for a new version and display a pop-up notification:

    Note

    This method displays a quick upgrade pop-up without forced upgrade logic. To force an upgrade, implement a custom upgrade.

      MPUpgrade mMPUpgrade = new MPUpgrade();
      mMPUpgrade.fastCheckNewVersion(activity, drawable);
  • Check for a new version and return only the 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 fastGetClientUpgradeRes to get detailed upgrade information:

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

The response includes the new version number, download URL, and other parameters:

  • downloadURL: the download URL.

  • guideMemo: the upgrade information.

  • newestVersion: the latest version number.

  • resultStatus: the upgrade mode.

    • 202 indicates a one-time reminder.

    • 204 indicates multiple reminders.

    • 203/206 indicates a forced upgrade.

  • fileSize: the download file size.

Other custom checks

For more customization options, see the following examples:

  • Implement the MPaaSCheckCallBack interface to handle requests from the upgrade SDK, such as displaying a 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 API reference.

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

Configure the download folder:

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

Also, 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 because certain ROMs access the application process during installation. A forced upgrade terminates this process, causing the failure. This custom ROM behavior does not comply with standard Android behavior. To resolve this issue, 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.

    • This callback prevents package parsing failures, but the upgrade component no longer automatically terminates the process. If a user returns to the application instead of tapping Install, display a non-cancelable pop-up overlay to prevent bypassing the forced upgrade.