All Products
Search
Document Center

Mobile Platform as a Service:Getting started

Last Updated:Jun 02, 2026

The new Mini Program container is available only in baseline 10.2.3 and supports only the native AAR connection type.

Prerequisites

Before you start, activate mPaaS and complete the native AAR connection. Add mPaaS to your project.

Procedure

To integrate the new Mini Program container:

  1. Select a baseline.

    1. Add baseline 10.2.3.

    2. Add the Mini Program component.

  2. Initialize the configuration.

    1. Initialize mPaaS.

    2. Configure Mini Program signature verification.

    3. Use the mPaaS kernel.

  3. Publish the Mini Program.

    1. Go to the Mini Program console.

    2. Configure a virtual domain name.

    3. Create a Mini Program.

    4. Publish the Mini Program.

  4. Start the Mini Program.

Each step is described in the following sections.

Select a baseline

  1. Add baseline 10.2.3.

    Click mPaaS > Native AAR Connection. Click Start Configuration under Add/Upgrade Baseline to add baseline 10.2.3.

  2. Add the Mini Program component.

    In your project, install the Mriver Tiny App component using Component Management (AAR).

Initialize the configuration

Initialize mPaaS

Initialize through the mPaaS framework (recommended)

  1. Add the initialization code to the Application class.

    public class MyApplication extends Application {
        
        @Override
        public void onCreate() {
            super.onCreate();
            // Initialize mPaaS
            MP.init(this);    
        }
    }

    Initialize mPaaS.

  2. Add the meta configuration to AndroidManifest.xml.

    <meta-data
        android:name="mpaas.init.param"
        android:value="com.xxx.xxx.MriverInitImpl" />
  3. Add com.xxx.xxx.MriverInitImpl and implement MPInitParamManifest.

    import android.content.Context;
    
    import com.mpaas.core.MPInitParam;
    import com.mpaas.mriver.api.init.MriverInitParam;
    
    public class MriverInitImpl implements com.mpaas.MPInitParamManifest {
        @Override
        public MPInitParam initParam(Context context) {
            MriverInitParam mriverInitParam = MriverInitParam.getDefault();
            mriverInitParam.setMriverInitCallback(new MriverInitParam.MriverInitCallback() {
                @Override
                public void onInit() {
                    if (com.alibaba.ariver.kernel.common.utils.ProcessUtils.isMainProcess()) {
                        // Mini Program-related configurations, such as custom JSAPIs and title bars
    
                    }
                }
    
                @Override
                public void onError(Exception e) {
    
                }
            });
            return MPInitParam.obtain().addComponentInitParam(mriverInitParam);
        }
    }

Initialize mPaaS using MPInit

To initialize mPaaS, add the following code to the Application class.

public class MyApplication extends Application implements MPInitParam.MPCallback {
    @Override
    public void onCreate() {
        super.onCreate();
        // Initialize mPaaS
        MriverInitParam mriverInitParam = MriverInitParam.getDefault();
        mriverInitParam.setMriverInitCallback(new MriverInitCallback() {
            @Override
            public void onInit() {
                if (com.alibaba.ariver.kernel.common.utils.ProcessUtils.isMainProcess()) {
                    // Mini Program-related configurations, such as custom JSAPIs and title bars

                }
            }

            @Override
            public void onError(Exception e) {

            }
        });
        MP.init(this, MPInitParam.obtain().setCallback(this).addComponentInitParam(mriverInitParam));
    }
    
    @Override
    public void onInit() {
        // init success
    }
}

Configure signature verification

The Mini Program container supports package signature verification. By default, verification is disabled for debug packages and enabled for release packages. Use the following API to control this feature:

// Disable signature verification
MriverResource.disableVerify();

// Enable signature verification. xx is the public key that corresponds to the private key configured in the console.
MriverResource.enableVerify(MriverResource.VERIFY_TYPE_YES,"xx");
Note

Enable signature verification before you publish the application. Configure a mini program package.

Configure the request interval for Mini Program packages

You can configure the request interval for Mini Program packages using an API:

Mriver.setConfig("h5_nbmngconfig", "{\"config\":{\"al\":\"3\",\"pr\":{\"4\":\"86400\","
    + "\"common\":\"864000\"},\"ur\":\"1800\",\"fpr\":{\"common\":\"3888000\"}},"
    + "\"switch\":\"yes\"}");

\"ur\":\"1800\" sets the global update interval in seconds. Valid values: 0 to 86400 (0 to 24 hours). Default value: 1800. A value of 0 removes the interval limit.

Important

Do not change other parameters.

Use the mPaaS kernel

Mini Programs use the mPaaS kernel for same-layer rendering of embedded components such as WebViews, maps, and videos. Connect to the mPaaS kernel.

Publish the Mini Program

Publish the Mini Program in the mPaaS console before you start it:

  1. Go to the Mini Program console. Log on to the mPaaS console. In the left navigation pane of the target application, go to Mini Program > Mini Program Release.

  2. Configure a virtual domain name. If this is your first time configuring a virtual domain name, go to Mini Program > Mini Program Release > Configuration Management to configure it. A virtual domain name can be any domain name. We recommend that you use your company's domain name, such as example.com.

  3. Create a Mini Program. In the mPaaS console, perform the following steps:

    1. In the left navigation pane, choose Mini Program > Mini Program Release.

    2. On the Mini Program package list page, click New.

    3. In the New Mini Program window, enter the Mini Program ID and name, and then click OK. The Mini Program ID can be any 16-digit number, such as 2018080616290001.

    4. In the Mini Program list, find the new Mini Program and click Add.

    5. In the Basic Information section, complete the following configurations:

      • Version: Enter the version number of the Mini Program package, such as 1.0.0.0.

      • Client Scope: The minimum and maximum Android client versions that can start this Mini Program. Set the minimum to 0.0.0 and leave the maximum empty to allow all client versions.

        Note

        Ensure that you enter the Android client version, not the Mini Program version.

      • Icon: Click Select File to upload an icon. An icon is required when you create a Mini Program for the first time. Sample icon:6

      • File: Upload the Mini Program resource file in .zip format. You can upload the mPaaS sample Mini Program (click to download) directly.

        Note

        Rename both the .zip file and the folder inside it to the 16-digit Mini Program ID before uploading.

    6. In the Configuration Information section, complete the following configurations:

      • Main Entry URL: Required. The home page of the Mini Program. The format of the main entry URL is /index.html#xxx/xxx/xxx/xxx. The part after the at sign (#), xxx/xxx/xxx/xxx, is the first value in the pages array in the app.json file of the Mini Program. As shown in the following figure, the main entry for the mPaaS sample Mini Program is /index.html#page/tabBar/component/index.7

      • Keep the default values for other configurations.

    7. Select I confirm that the above information is accurate and will not be modified after submission.

    8. Click Submit.

  4. Publish the Mini Program. In the mPaaS console, perform the following steps:

    1. In the left navigation pane, click Mini Program > Mini Program Release > Official Mini Program Package Management.

    2. On the Mini Program package list page, select the Mini Program package and version that you want to publish, and then click Create Release.

    3. In the Create Release taskbar, complete the following configurations:

      • Release Type: Select the Official release type.

      • Release Description: Optional.

      Click OK to create the release.

Start the Mini Program

After you complete the preceding steps, start the sample Mini Program with the following code:

Mriver.startApp("2018080616290001");
Note

2018080616290001 is a sample Mini Program ID. Replace it with your own.