I’m integrating the Mailchimp mobile SDK into my Flutter app. I’m using MethodChannel
to call native Android/iOS code.
I successfully integrated but on Android it only works in debug
mode. In release mode the contact doesn’t get created. Does it need some extra permission to work in release?
This is the kotlin code that creates a contact:
val configuration = MailchimpSdkConfiguration.Builder(appContext, sdkKey)
.isAutoTaggingEnabled(true)
.build()
Mailchimp.initialize(configuration)
val newContact = Contact.Builder(email)
.setContactStatus(ContactStatus.SUBSCRIBED)
.build()
val sdk = Mailchimp.sharedInstance()
sdk.createOrUpdateContact(newContact)
Also in the documents the iOS code example shows how to check the result:
Mailchimp.createOrUpdate(contact: contact) { result in
switch result {
case .success:
print("Successfully added or updated contact")
case .failure(let error):
print("Error: (error.localizedDescription)")
}
}
How to do the same on Android? I’ve tried using getStatusById
but it only returns QUEUED
and doesn’t return if the contact has been created or not:
val uuid = sdk.createOrUpdateContact(newContact)
val status = sdk.getStatusById(uuid) // status.name -> QUEUED
How to wait for the result on Android?
What am I missing to work in release mode?