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.
The code for reporting active devices is as follows:
- 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:
If the active device reporting API is called several times within the reporting interval, only the first call takes effect.
The code for reporting active users is as follows:
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,
userIdis set in the code. That is,
userIdis set successfully.
- In addition, you can also call the code in [Set user ID] to set
The code for setting a user ID is as follows:
- After setting a
userId, you can add the
userIdto 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
userIdso as to ensure the accuracy of relevant data.