All Products
Search
Document Center

Mobile Platform as a Service:Android client diagnosis

Last Updated:Jan 23, 2026

This topic describes how to use the client diagnosis function on Android clients. In the console, you can send diagnosis tasks through two channels: Message Push Service (MPS) and Mobile Sync Service (MSS).

To diagnose an Android client, follow these steps:

  1. Initialize the diagnosis service

  2. Write diagnostic logs

  3. Pull logs from the console

Prerequisites

Initialize the diagnosis service

The diagnosis service supports pulling diagnostic logs through the Mobile Sync Service or Message Push Service channel. The initialization method is different for each channel.

Use the Message Push Service channel

If you use the Message Push Service channel, perform the following operations after the app starts:

Use the Mobile Sync Service channel

If you use the Mobile Sync Service channel, call the following methods after the app starts to initialize the channel.

  • Trigger a diagnostic task by user

    // Set the userId
    MPLogger.setUserId(String userId);
    // Initialize the Sync channel. You must set the userId first, or the initialization will fail.
    MPDiagnose.initSyncChannel(Context context);
  • Trigger a diagnostic task by device

    Note

    Triggering diagnostic tasks by device is supported only in baseline 10.2.3.73 and later.

    // Set the userId
    MPLogger.setUserId(String userId);
    // Initialize the Sync channel. You must set the userId first, or the initialization will fail.
    MPDiagnose.initSyncDeviceChannel(Context context);

Write diagnostic logs

When the client receives a diagnostic task, it only uploads logs that were written using the mPaaS logging tool, MPLogger. Therefore, you must use MPLogger instead of android.util.Log to write logs. MPLogger provides log level methods that are similar to the native Log class:

void verbose(String tag, String msg);
void debug(String tag, String msg);
void info(String tag, String msg);
void warn(String tag, String msg);
void warn(String tag, Throwable t);
void warn(String tag, String msg, Throwable tr);
void error(String tag, String msg);
void error(String tag, Throwable t);
void error(String tag, String msg, Throwable t);
void print(String tag, String msg);
void print(String tag, Throwable t);

Logs written by MPLogger are displayed in logcat for debug packages but not for release packages. The storage directories for diagnostic logs on the device are:

  • Debug package: /sdcard/[PackageName]/applog. If this directory is not writable, logs are written to the release package directory.

    Important

    If targetSdkVersion is 30 or later and the phone's operating system is 11 or later, the storage directory is: /storage/emulated/0/Android/data/com.mpaas.demo/cache/[PackageName]/applog/.

  • Release package: /data/data/[PackageName]/files/applog.

Customize diagnostic log storage parameters

By default, local log storage retains data for 7 days with a file size limit of 15 MB. If this limit is exceeded, one-quarter of the log files are deleted.

Configure a <meta-data> element in the manifest.

// Maximum size of log files in MB
<meta-data android:name="category_applog_max_size" android:value="15" />
// Log storage duration in days
<meta-data android:name="category_applog_expires_time" android:value="7" />
Note

Customizing diagnostic log storage parameters is supported only in baseline 10.2.3.73 and later.

Pull logs from the console

You can pull logs written by the mPaaS logging tool from the console. This feature helps you quickly analyze crashes or exceptions that occur on specific device models or for specific users.

Step 1: Create a log pull task

  1. Log on to the mPaaS console and select your target application.

  2. In the navigation pane on the left, click Mobile Analysis Service > Log Management.

  3. On the Pull real-time logs tab, click the Add.

  4. Fill in the task information. The User ID is the identifier for a user in your application's logon system. You can set it using MPLogger.setUserId(String userId) or the method for reporting user IDs through Message Push Service.

  5. Click the OK to create the log pull task.

Step 2: Trigger the log pull task

  1. In the list of log pull tasks, find the task you just created, select a Trigger Channel, and then click Trigger in the Operations column.

  2. Wait for a moment and then refresh the page to check the task status:

    • Task processed: Click the View to download the diagnostic log.

    • Push/Sync service successfully called: This status indicates that the message to upload the diagnostic log has been sent, but the client has not yet received it or uploaded the log. In this case, confirm that your app process is still running. If it is not, restart the app. If the task status does not change after you restart the app, see the troubleshooting section below.

Troubleshooting

If you cannot pull logs, follow the troubleshooting steps that correspond to the channel used to send the diagnostic log task.

Use the Message Push Service channel

Follow these steps to troubleshoot:

  1. Go to the mPaaS console > Message Push Service page. Push a regular message to your app based on the user ID to confirm that the Message Push Service channel is working correctly.

  2. If the Message Push Service channel is working correctly, clear the logcat logs, switch to the push process, and then click Trigger again for the diagnostic task in the console. Monitor the logcat logs.

  3. Filter for mPush14 and check if the diagnostic message is received. If not, confirm whether the push channel is disconnected. image.png

  4. After you confirm that the diagnostic message is received, check for the following log to confirm that the message was forwarded to MonitorService. If an error indicates that ClientMonitorService cannot be found, use the mPaaS plugin to update the SDK:

    • For baseline 10.1.32, upgrade to 10.1.68 and update the component to the latest version.

    • For baseline 10.1.60 or 10.1.68, update the component to the latest version.2

  5. After you confirm that MonitorService has started, filter for AlipayLogUploader to check if a diagnostic log exists locally. The following log indicates that a local diagnostic log is available for upload.

    本地存在日志

    The following log indicates that no diagnostic log exists.

    本地不存在日志

    If no diagnostic log exists, check the following items:

    • The time period selected for the real-time log pull task in the console must be at least 1 hour. The app must be running and writing diagnostic logs during this period.

    • The app must declare and dynamically request the following permission:

      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  6. After you confirm that a local diagnostic log exists, filter for HttpUpload to check if the log upload was successful. A responseCode of 200 indicates a successful upload. 3

Use the Data Synchronization channel

Follow these steps to troubleshoot:

  1. Clear the logcat logs, switch to the main process, and initialize the synchronization channel. Then, filter for isConnected to check if the synchronization channel connection was established successfully.

  2. In the mPaaS console, click Trigger again for the diagnostic task. Filter for MPDiagnose to check if the diagnostic message was received and if MonitorService was started.

    If no message is received, confirm that the set user ID matches the user ID entered in the diagnostic task. If an error indicates that ClientMonitorService cannot be found, use the mPaaS plugin to update the SDK:

    • For baseline 10.1.32, upgrade to 10.1.68 and update the component to the latest version.

    • For baseline 10.1.60 or 10.1.68, update the component to the latest version.

  3. After you confirm that MonitorService has started, switch to the push process and filter for AlipayLogUploader to check if a diagnostic log exists locally. The following log indicates that a local diagnostic log is available for upload.The following log indicates that no diagnostic log exists.

    Verify the following items:

    • The time period selected for the real-time log pull task in the console must be at least 1 hour. The app must be running and writing diagnostic logs during this period.

    • The app must declare and dynamically request the following permission:

      <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  4. After you confirm that a local diagnostic log exists, filter for HttpUpload to check if the log upload was successful. A responseCode of 200 indicates a successful upload.