All Products
Search
Document Center

Mobile Platform as a Service:Quick start

Last Updated:Nov 17, 2023

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 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).

Componentized integration mode

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

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

Initialize mPaaS

Native AAR

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

Add the following codes in the object Application:

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

For more details, see Initialize mPaaS.

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 About client diagnosis, 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

Get IMEI / IMSI

On systems lower than Android 10, the IMEI and IMSI of the device will be obtained by default if the relevant permissions have been obtained. If you need to completely prohibit the behavior of obtaining such information, please add the following configuration to AndroidManifest:

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

It only takes effect on 10.2.3.6 and above baselines. After the configuration is added, mobile analysis, message push, and data synchronization will no longer obtain the device's IMEI and IMSI.

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.