2

We have a Android App (Kotlin) and we declared Mobile App Events in Journey Builder.

We created a Journey with an entry source configured to respond to one of our Events and are struggling to trigger it from our App.

The documentation indicates the following call example :

val event = EventManager.customEvent("EventName", mapOf("key1" to "value2", "key2" to "value2"))
SFMCSdk.track(event)

However, when doing this, we get the following error :

Type mismatch.
Required: com.salesforce.marketingcloud.sfmcsdk.components.events.Event?
Found: com.salesforce.marketingcloud.events.Event?

So we are stuck doing the call.

Any help appreciated.

2 Answers 2

4

Well, we had the same error. It happens that EventManager is of the wrong type.

This will work :

val event = com.salesforce.marketingcloud.sfmcsdk.components.events.EventManager.customEvent("Your Event")
SFMCSdk.track(event)
1
1

This works here :

val event = EventManager.customEvent("Event")
event!!.track()
3
  • 1
    Compiles indeed, but accepting the above answer since EventManager seems of the right type. Aug 14, 2022 at 15:39
  • 2
    That make sense. However, this code actually fires an App Event so both should work. Aug 14, 2022 at 15:40
  • 1
    This should be event?.track() for safety. The creators, like customEvent(string: String) are intended to do validation and may not return a null.
    – Bill Mote
    Aug 15, 2022 at 10:47

You must log in to answer this question.

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