在为 android Kotlin 使用 AppCenter API 时,是否允许我在同一个会话中多次更改我的 UserId

When using the AppCenter API for android Kotlin, Am I allowed to change my UserId multiple times in the same session

抱歉这个问题含糊不清,但它实际上很简单。

当我的 android 应用程序启动时,我按如下方式初始化 AppCenter:

   AppCenter.start(
        this, BuildConfig.APP_CENTER_SECRET,
        Analytics::class.java, Crashes::class.java, Distribute::class.java
    )
    if(BuildConfig.FLAVOR != ApplicationVariants.ProductFlavors.PRODUCTION){
        AppCenter.setLogLevel(Log.VERBOSE)
    }
    AppCenter.setUserId(UUID.randomUUID().toString())
    Distribute.setUpdateTrack(UpdateTrack.PUBLIC)
    Distribute.checkForUpdate()

但是,当用户登录到应用程序时,我想在用户登录后将 UserId 设置为用户电子邮件,如下所示:

JwtUtils.getIdentityTokenModel(requireContext())?.let {
        AppCenter.setUserId(it.email)
    }

最后,当用户注销时,我将用户 ID 重置为随机 guid。这样做的原因是可以看到哪个用户拥有哪些崩溃日志。这是业务要求。

但是,在应用中心崩溃日志中,即使用户登录时发生错误,UserId 似乎也不会更改为电子邮件。

我的问题很简单。我可以更改 AppCenter 用户 ID 的次数是否有限制?我似乎无法在文档中的任何地方找到它。

提前致谢

请参阅these docs关于userId API:

The value for the user ID is limited to 256 characters. It will be shown with your crash reports but not used for aggregation or counts of affected users. In case you set user ID multiple times, only the last user ID will be used. You need to set the user ID yourself before each application launch, because this value isn't stored by the SDK between launches.