We're getting an error in our Android app when we attempt to call loginIdentifiedUser()
The code is very simple and we can't work out why we're seeing this error. Here's the logs from logcat:
D/IntercomAPI: login identified..
I/Intercom: Dispatched Action: SOFT_RESET: No Value
I/Intercom: Successfully reset the user. To resume communicating with Intercom, you can register a user
I/Intercom: Dispatched Action: HARD_RESET: No Value
I/Intercom: We already have a registered user. Updating this user with the attributes provided.
E/Intercom: Failed to register or update user: A network request was made with no user registered on this device.Please call registerUnidentifiedUser() or registerIdentifiedUser(Registration).
D/IntercomAPI: login identified failed: 1001 : ERROR - -HTTP -1] - Something went wrong
The log seems to be stating that the network call to loginIdentifiedUser is failing because we haven't logged in. That doesn't really make sense.
Here's the code that around loginIdentifiedUser:
Log.d(TAG, "login identified..")
Intercom.client().logout()
Intercom.client().setUserHash(hash)
val userAttributes = baseAttributes
.withEmail(user.email)
.withName(user.name)
.build()
val registration = Registration
.create()
.withUserAttributes(userAttributes)
Intercom.client().loginIdentifiedUser(registration, object : IntercomStatusCallback {
override fun onFailure(intercomError: IntercomError) {
Log.d(TAG, "login identified failed: ${intercomError.errorCode} : ${intercomError.errorMessage}")
}
override fun onSuccess() {
Log.d(TAG, "login identified success")
currentState = States.IDENTIFIED
}
})
The same error occurs with or without the call to logout() near the top. We just put that in there to see if it made a difference.
Thanks for any advice