I'm using Marketing Cloud to send push notification to our Android users. I also need that the contact key is valorized as userId when the user performs the login. So in the same transaction, I update the contact key (with the user id) and another field that contains the user id too. This is the snippet of code:

MarketingCloudSdk.requestSdk {
        it.registrationManager.edit().run {
            attributesToSet.forEach { attribute ->
                setAttribute(attribute.key, attribute.value)

            if (contactKey != null && contactKey.isNotBlank()) {

The attributesToSet is a Map and an entry has the "user_id" as key and the user id value (e.g. 10102334) as value. The contactKey contains the user id value too.

In some rows of my Mobile Push table I see that the user_id column is valorized and the corresponding contactKey is not equal to the user id. This is strange because the updating of the contactKey and user_id columns is done in the same transaction.

Someone have any suggestions about this issue?

1 Answer 1


The only requirements for Contact Key are that it is not null, does not contain only whitespace characters and that it is less than 100 characters in length. We do not currently enforce the length requirement in the SDK as that could be changed server side. Also, there is a uniqueness requirement that we cannot enforce in the SDK, but that would be unrelated to your question, though I figured it was worth calling out here while documenting other requirements.

What does the output from getSdkState() show for your registrations?

You should open a support request through your account executive for this issue so that we can better assist you -- we have no known issues with Contact Key operations in the SDKs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .