[Android] Can't implement alias

  • 31 October 2019
  • 3 replies


Hello. I have a problem with implementing aliases logic. More precisely, there is no problem - they just do not work on android.
That my code:

override fun alias() {
userStorage.userId?.let {
val distinctId = mixpanel.distinctId
mixpanel.alias(it.toString(), distinctId)

override fun identify(id : String) {
id.let {

Alias fun call only after register new user, identify - on login. All send data is valid, but in Live View i see only distinct_id from mixpanel. Can some help me to solve this problem?

3 replies

Userlevel 2

Hi @Roman,

Can you clarify what you mean by "in Live View i see only distinct_id from mixpanel"? It sounds like you are getting data in and what you are seeing is the distinct ID showing up in your Live View. Was there something else you wanted to see come up on Live View?

Maybe you have seen this, but I thought I share Mixpanel's Android dev docs. I also did a quick search and found a semi similar issue on Stack Overflow that might help


Hi! I'm trying to merge events by user id. It is assumed that after the login, the events created before the login will be assigned to the user profile to which we registered. But this is not happening. Mixpanel just create a new user :(

Userlevel 2

I see, so it sounds like it is not appending the anonymous data to the user profile. Looking back I noticed you said is that you are calling alias when a user creates an account and identify when they log in. From the code you shared, is this only for your sign up(create account)?

When looking at the docs it recommends a slightly different approach from what were are used to. The recommended usage pattern is to call both alias and identify when the user signs up (create account) and only identify (with the aliased user ID) on future log ins.