Activation logs

更新时间:
复制 MD 格式

Add instrumentation to track device installations and user counts for your mPaaS Android app, then view the metrics on the Mobile Analysis console.

Activation logs track two dimensions of app engagement:

  • Device activation: Counts the number of app installations.

  • User activation: Counts the number of app users.

View metrics including active users, new users, and active accounts on the Data Overview page of the Mobile Analysis console.

Device activation instrumentation

The mPaaS framework reports device activation logs automatically — no code changes are required. This behavior is supported in baseline 10.1.68.30 and later.

When the app returns to the foreground after being in the background, the SDK reports a device activation log only if the time elapsed since the last report exceeds the reporting interval. The default interval is 30 minutes. Multiple triggers within a single interval are deduplicated — only the first is recorded.

To disable automatic reporting, add the following to your AndroidManifest.xml file:

<meta-data
    android:name="report.launch.switch"
    android:value="off" />

After disabling automatic reporting, call the following method at the appropriate point in your app lifecycle to report device activation manually:

MPLogger.reportClientLaunch();

To customize the reporting interval (in milliseconds), call:

MPLogger.setReportClientLaunchInterval(long interval);

User activation instrumentation

Call the following method after a user successfully logs in, or any time you get a valid userId:

MPLogger.reportUserLogin(String userId);

userId is the unique identifier for the user in your app's login system. You can call this method after the user successfully logs on or in other cases where you successfully obtain the userId.

Calling reportUserLogin() automatically sets the userId in the SDK. To set the userId separately, call:

MPLogger.setUserId(String userId);

After setting a userId, you can use it for Real-time Release > Whitelist publishing in the mPaaS console.

When a user logs out, call MPLogger.setUserId(null) to clear the userId and prevent subsequent events from being attributed to that user.