Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only complete initialization after userId is properly set #188

Open
gabrielgarciagava opened this issue Apr 22, 2024 · 0 comments
Open

Only complete initialization after userId is properly set #188

gabrielgarciagava opened this issue Apr 22, 2024 · 0 comments

Comments

@gabrielgarciagava
Copy link

Summary

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant