You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, if we initialize the plugin via Amplitude.getInstance() and try to get userId from it via Amplitude.getInstance().getUserId() right after, the userId is not set yet, because the initialization happens in a background thread and there is not a proper way to know when it is completed.
I've seen a initCompletionBlock that can be used for that on the iOS SDK, but I couldn't find one in the Android one. So maybe a change on the Android SDK would also be needed to achieve this.
Motivations
Since we don't know when the userId will be ready, we need to wait some arbitrary amount of time. Since we use the presence of the userId to make some initialization decisions, if by any reason the amplitude initialization takes longer (e.g. some database migration), we will take the wrong initialization route.
The text was updated successfully, but these errors were encountered:
Summary
Currently, if we initialize the plugin via
Amplitude.getInstance()
and try to get userId from it viaAmplitude.getInstance().getUserId()
right after, the userId is not set yet, because the initialization happens in a background thread and there is not a proper way to know when it is completed.I've seen a
initCompletionBlock
that can be used for that on the iOS SDK, but I couldn't find one in the Android one. So maybe a change on the Android SDK would also be needed to achieve this.Motivations
Since we don't know when the userId will be ready, we need to wait some arbitrary amount of time. Since we use the presence of the userId to make some initialization decisions, if by any reason the amplitude initialization takes longer (e.g. some database migration), we will take the wrong initialization route.
The text was updated successfully, but these errors were encountered: