All Products
Document Center

Start mini program

Last Updated: Feb 05, 2021

This section demonstrates the following operations:

  1. Start mini program
  2. Run the mini program in real device

Start mini program

Starting the mini program simply needs one line of code.

Once the mini program package is uploaded to the mPaaS console, you can replace the “Hello mPaaS!” Toast related code (Toast.makeText(MainActivity.this, "Hello mPaaS!", Toast.LENGTH_SHORT).show();) in the MainActivity with the following code, so that the mini program starts upon a click on TextView.

  1. MPNebula.startApp("2020080120200801");


Note: The mini program ID “2020080120200801” here is only for reference, please replace it with your real mini program ID in practice.

Run the mini program in real device

  1. Connect your mobile to the computer, and turn on the USB debugging mode.
  2. Run the project in Android Studio to update the App installed on your mobile.
  3. Open the App on the mobile, click the text “Hello World” to start the mini program.

Now, you have successfully started the mini program and run it on the real device.

Code sample

Click to download the demo used in the tutorial.