All Products
Search
Document Center

Mobile Platform as a Service:Pass startup parameters to Android Mini Program

Last Updated:Jun 02, 2026

Pass startup parameters from the Android client to the default landing page of the Mini Program (pages/index/index). The following procedure uses name and pwd as example parameters.

Prerequisites

Before you begin, ensure that you have accessed the mini program component by referring to Getting started.

Pass startup parameters

  1. On the client, add startup parameters to the Mini Program launch call.

    Use a Bundle object to pass parameters. Set key="query" to a URI-encoded key-value string, then call startApp:

    Bundle param = new Bundle();
    String query = "name="+Uri.encode("123")+"&pwd="+Uri.encode("456");
    param.putSting("query",query); // set the parameter.
    MPNebula.startApp(appId:"2020121620201216",param);

    The startup parameter field is query. Encode values as key-value pairs (for example, key1=value1&key2=value2), then parse the query field on the Mini Program side to retrieve them.

    startApp parameters:

    • appId: The Mini Program ID. Find it in the mPaaS console.

    • param: A Bundle object containing the startup parameters. Set key="query" and value to a URI-encoded key-value string. Separate multiple parameters with an ampersand (&).

      Important
      • The Mini Program framework URI-decodes each parameter value. URI-encode your values before passing them.

      • The Mini Program framework does not process parameter keys. Do not use special characters in keys — the framework may fail to recognize them.

  2. In the Mini Program, retrieve the startup parameters from the options argument of onLaunch/onShow(options).

    obtain param

    The app.js script stores the parameters in the globalData global variable. To use a parameter — such as token or user_id passed from Native in the request header — read or update globalData directly from any page in the Mini Program.

    app.js