All Products
Search
Document Center

Mobile Platform as a Service:Loading framework and customization

Last Updated:Jun 03, 2026

The mPaaS Android framework controls the app startup sequence. This topic explains how the startup flow works and how to inject your own initialization logic using agent classes.

Startup flow

Application

A standard Android APK loads the Application class specified in the android:name attribute of the application node in AndroidManifest.xml.

The mPaaS framework replaces this default loading behavior. Set the android:name attribute to the framework's com.alipay.mobile.quinox.LauncherApplication class:

<application
    android:name="com.alipay.mobile.quinox.LauncherApplication"
    android:allowBackup="true"
    android:debuggable="true"
    android:hardwareAccelerated="false"
    android:icon="@drawable/appicon"
    android:label="@string/name"
    android:theme="@style/AppThemeNew" >
</application>

Startup page

Loading the framework bundle takes time. The startup page holds the screen while the framework initializes, before navigating to your app's home page. Register com.alipay.mobile.quinox.LauncherActivity as the startup Activity in AndroidManifest:

<activity
android:name="com.alipay.mobile.quinox.LauncherActivity"
android:configChanges="orientation | keyboardHidden | navigation"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

The mPaaS startup process is encapsulated to prevent accidental modification. As a result, LauncherApplication and LauncherActivity are not directly accessible to your code.

To inject your own logic, mPaaS provides LauncherApplicationAgent and LauncherActivityAgent. Inherit these classes and implement your initialization logic in their callbacks. If you define these classes in a bundle project, configure ProGuard to prevent obfuscation. For more information, see Obfuscate Android files.

Startup flowchart

The mPaaS Android framework loads as follows:image

  1. The framework creates the LauncherActivity startup page on the main thread and calls preInit on LauncherActivityAgent.

  2. The framework performs multidex: it calls preInit on LauncherApplicationAgent, reads each bundle's descriptor from the APK, creates a class loader per bundle, and loads the bundle's resources.

  3. After initialization completes, the framework calls postInit on both LauncherActivityAgent and LauncherApplicationAgent.

Customization

The framework generates two agent classes in the Launcher project: MockLauncherApplicationAgent and MockLauncherActivityAgent. These extend LauncherApplicationAgent and LauncherActivityAgent and are called by LauncherApplication and LauncherActivity during startup.

The Portal's AndroidManifest.xml registers both agents and the startup page layout. To move the agents to a Bundle instead, update the value of the corresponding meta-data entry:

     <application
          android:name="com.alipay.mobile.quinox.LauncherApplication" >

         <!-- Callback configuration for the Application -->
         <meta-data
            android:name="agent.application"
            android:value="com.mpaas.demo.launcher.framework.MockLauncherApplicationAgent"/>

        <!-- Callback configuration for the Activity -->
        <meta-data
            android:name="agent.activity"
            android:value="com.mpaas.demo.launcher.framework.MockLauncherActivityAgent"/>
        <!-- Layout configuration for the startup page -->
        <meta-data
            android:name="agent.activity.layout"
            android:value="layout_splash"/>

     </application>

Agent classes

The agent.application meta-data entry points to your ApplicationAgent implementation. Use preInit() for pre-framework setup and postInit() for framework-dependent initialization:

  public class MockLauncherApplicationAgent extends LauncherApplicationAgent {
      @Override
      protected void preInit() {
          super.preInit();
          // Before framework initialization
          // Do NOT call MicroApplicationContext or any framework APIs here
      }

      @Override
      protected void postInit() {
          super.postInit();
          // After framework initialization
          // Framework APIs (e.g., MicroApplicationContext) are available here
      }
  }

In LauncherApplicationAgent, your app can perform Application-level initialization. preInit() runs before the framework initializes — do not call any framework APIs, such as MicroApplicationContext, at this point. postInit() runs after initialization completes and framework APIs are available.

The agent.activity meta-data entry points to the startup Activity agent. Use postInit() to navigate to your app's home screen:

public class MockLauncherActivityAgent extends LauncherActivityAgent {

        @Override
        public void preInit(Activity activity) {
                super.preInit(activity);
                // Before the Launcher Activity starts
        }

        @Override
        public void postInit(final Activity activity) {
            super.postInit(activity);
                // After the Launcher Activity starts
                // Logic to navigate to the application's home page
                startActivity(activity,YOUR_ACTIVITY);
        }
}

LauncherActivityAgent follows the same preInit/postInit timing as LauncherApplicationAgent: both callbacks occur before and after framework initialization.

Modify the startup page layout

The startup page layout is set via the agent.activity.layout meta-data entry in the Portal's AndroidManifest.xml:

<application
android:name="com.alipay.mobile.quinox.LauncherApplication" >
<!-- Layout configuration for the startup page -->
<meta-data
android:name="agent.activity.layout"
android:value="layout_splash"/>

</application>

Set the value to the name of your custom layout file.

Note

Place the layout file and its referenced resources in the Portal project.

Related links

Code example