All Products
Document Center

Active device/user log

Last Updated: Jun 09, 2021

The active state logs are classified into two categories:

  • Active device log: collects the number of devices where an App is started.
  • Active user log: collects the number of users who log in to an App.

After these logs are reported, you can view indicators such as the number of active users, number of new users, and number of active accounts under Mobile Analysis Service > Data overview.


Active device reporting

The code for reporting active devices is as follows:

  1. MPLogger.reportClientLaunch();
  • The mPaaS framework automatically reports the data of active devices, you don’t have to deal with it.
  • When an App returns to the frontend from the backend, another active device is counted if the interval since the last reporting exceeds the specified interval (30 minutes by default).

You can customize a reporting interval in milliseconds. The code is as follows:

  1. MPLogger.setReportClientLaunchInterval(long interval);

If the active device reporting API is called several times within the reporting interval, only the first call takes effect.

Active user reporting

The code for reporting active users is as follows:

  1. MPLogger.reportUserLogin(String userId);

userId uniquely identifies a user who logs in to your App. You can call the active user reporting API after successful user login or after you obtain userId in another way.

  • After you call the active user reporting API, userId is set in the code. That is, userId is set successfully.
  • In addition, you can also call the code in [Set user ID] to set userId separately.

The code for setting a user ID is as follows:

  1. MPLogger.setUserId(String userId);
  • After setting a userId, you can add the userId to a whitelist created under Mobile Delivery Service > Whitelist management in the mPaaS console.
  • When the user logs out, call MPLogger.setUserId(null) to delete the userId so as to ensure the accuracy of relevant data.