All Products
Search
Document Center

Mobile Platform as a Service:Create an application in Android Studio

Last Updated:Feb 02, 2026

In this section, you will create an application that displays a Toast message when a button is clicked. You will also generate an APK installation package.

The process has four main steps:

  1. Create a project

  2. Write the code

  3. Create a signature file and sign the project

  4. Install the application on a mobile phone

If you already have a signed, native Android project, you can skip this tutorial and go directly to Create an application in the mPaaS console.

Create a project

  1. Open Android Studio and click File > New > New Project.

  2. In the window that appears, select Empty Activity and click Next.

  3. Enter a Name, Package name, and Save location. For this tutorial, set the Name to H5 Application. You can use the default package name. Set Minimum SDK to API 18: Android 4.3 (Jelly Bean).

    Note

    API 18: Android 4.3 (Jelly Bean) is the minimum version that mPaaS supports. Select the version required for your production environment.

  4. Click Finish to create the project.

Write the code

  1. Open the activity_main.xml file and add a button using the following code.

     <Button
         android:id="@+id/button"
         android:layout_width="101dp"
         android:layout_height="50dp"
         android:layout_marginStart="142dp"
         android:layout_marginTop="153dp"
         android:layout_marginBottom="151dp"
         android:text="Button"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
  2. Open the MainActivity class and add a click event for the button.

         findViewById(R.id.button).setOnClickListener(new View.OnClickListener(){
             @Override
             public void onClick(View v) {
                 Toast.makeText(MainActivity.this, "Hello mPaaS!", Toast.LENGTH_SHORT).show();
             }
         });
  3. A successful compilation means you have finished writing the code.

Create a signature file and sign the project

  1. In Android Studio, click Build > Generate Signed Bundle / APK.

  2. In the window that appears, select APK and click Next.

  3. Select Create new.

  4. Enter the required information and click OK. The signature file is generated in the specified Key store path.

  5. After the content is automatically populated, click Next to add a signature to the project.

  6. Select a Build Variant based on your needs. Then, check V1 (Jar Signature). This option is required, while V2 (Full APK Signature) is optional.

  7. Click Finish. After the packaging process is complete, the signed APK installation package is located in the debug folder (~\MyHApplication\app\debug) of your project. In this tutorial, the package is named app-debug.apk.

Install the application on a mobile phone

  1. Connect your phone to the computer and enable USB debugging mode.

  2. Run the project.

  3. Click BUTTON. A Toast message appears. This confirms that the application is installed and works as expected.