All Products
Search
Document Center

Mobile Platform as a Service:Quick Start

Last Updated:Jun 03, 2026

Mobile Analysis Service (MAS) uses the client SDK for instrumentation. The SDK collects data, such as user behavior and app performance, generates logs, and reports them to the server. The server then extracts valid data from the uploaded logs based on a predefined data format. This process lets you monitor and analyze various client metrics.

This topic describes how to quickly integrate the Mobile Analysis Service (MAS) component into an Android client. The MAS component supports two integration types: native AAR integration and component-based integration.

The complete integration process consists of the following six steps:

  1. Add the SDK

  2. Initialize mPaaS

  3. Add configurations

  4. Add logs

  5. View local logs

  6. Report logs

Prerequisites

Add the SDK

Native AAR integration

Use Component Management (AAR) to install the Logging (LOGGING) component in your project. For more information, see Manage component dependencies (Native AAR) and AAR component management.

Component-based integration

In your Portal and Bundle projects, install the Logging (LOGGING) component using Component Management. For more information, see integration process and add component dependencies.

Initialize mPaaS

Native AAR integration

If you use the native AAR integration type, you must initialize mPaaS.

To do this, add the following code to the Application object:

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

For more information, see Initialize mPaaS.

Component-based integration

If you use the component-based integration type, the mPaaS framework is automatically initialized. No action is required.

Add configurations

Upload logs

Uploading logs requires network access. Declare the following permissions in the AndroidManifest file.

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

Log diagnostics

If you want to use the log diagnostics feature, declare the following permission in the AndroidManifest file. Also, dynamically request this permission at runtime on devices running Android 6.0 or later.

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Diagnostic logs are saved to the device's SD card. If you do not request this permission, you may not be able to retrieve the diagnostic logs.

Set a channel ID

To distinguish data from APKs of different channels in the console, set a channel ID for each APK.

Create a channel.config file in the assets folder of your project and modify the value of channel_id.

# Identifies the current distribution channel
channel_id=alipay

If you do not create the channel.config file, the channel ID defaults to mpaas_default.

Get IMEI/IMSI

On systems earlier than Android 10, the device's IMEI and IMSI are obtained by default if the required permissions are granted. To completely disable this behavior, add the following configuration to the AndroidManifest file:

<meta-data
    android:name="imei.switch"
    android:value="off" />
Note

This configuration applies only to baseline 10.2.3.6 and later. After you add this configuration, Mobile Analysis Service, Message Push Service, and Mobile Sync Service will no longer obtain the device's IMEI and IMSI.

Enable service self-start detection

To address the issue where TianyanLoggingService automatically restarts on certain devices even after the app has been manually force-stopped, add the following configuration to the AndroidManifest.xml to disable auto-start:

<meta-data
 android:name="open_service_self_start_detection"
 android:value="true" />
Note

This configuration applies only to baseline 10.2.3.77 and later.

Add logs

After you integrate the SDK, add the necessary code to generate the following types of logs:

View local logs

For instructions on how to view local log information, see View local logs.

Report logs

To synchronize logs from the client's local files to the log server, see Report logs.