All Products
Search
Document Center

Quick start

Last Updated: Mar 07, 2022

Mobile Analysis Service (MAS for short) depends on the client SDK to implement event tracking, collect user behavior, App performance and other related data to generate logs, and report the logs to the server. The server extracts valid data from the tracking logs uploaded by the client based on the negotiated tracking log format to monitor and analyze client metrics.

This topic briefly describes how to fast integrate MAS to the Android client. You can integrate MAS through Native AAR, mPaaS Inside, or Portal & Bundle.

The complete integration process mainly includes the following six steps:

  1. Add SDK

  2. Initialize mPaaS

  3. Set project

  4. Add logs

  5. View local logs

  6. Upload logs

Prerequisites

Add SDK

Native AAR mode

Follow the instructions in AAR component management to install the LOGGING component in the project through Component management (AAR).

mPaaS Inside mode

Install the LOGGING component in the project through Component management (AAR).

Fore more information, see Manage component dependencies > Add/delete component dependencies.

Componentized integration mode

Install the LOGGING component in the Portal and Bundle projects through Component management.

Fore more information, see Manage component dependencies > Add/delete component dependencies.

Initialize mPaaS

Native AAR/mPaaS Inside mode

If you integrate MAS through Native AAR or mPaaS Inside, you must initialize mPaaS.

Add the following codes in the object Application:

public class MyApplication extends Application {
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        // Set mPaaS initialization callback setting
        QuinoxlessFramework.setup(this, new IInitCallback() {
            @Override
            public void onPostInit() {
                // This callback indicates that mPaaS initialization has been done, and relevant mPaaS calls can be performed here
            }
        });
    }
    @Override
    public void onCreate() {
        super.onCreate();
        // Initialize mPaaS
        QuinoxlessFramework.init();
    }
}

Componentized integration mode

To integrate MAS in componentized integration mode (Portal & Bundle), you don't have to implement mPaaS initialization.

Set project

Log uploading

Network access is required to upload logs. You need to 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 diagnosis

To use the log diagnosis function, you need to declare the following permission in the AndroidManifest file, and apply for the permission when the App runs on the Android 6.0+ devices.

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

The diagnostic log will be saved to the SD card of the device. With above permission, you cannot obtain the diagnostic log.

Channel number setting

To distinguish the apk data of different channels in the mPaaS console, you can set channel number for the apk.

In the App project, create the channel.config file under the directory assets and modify the value of channel_id.

# Identify the current release channel
channel_id=alipay

Add logs

You can add the following logs after integrating the SDK:

View local logs

View local logs to learn the local log information.

Upload logs

Synchronize the local files on a client to the log server. For specific operations, see Upload logs.