Android SDK (Core)
Integrate EXP Events
3 min
to integrate exp events using the nwcore sdk, developers should follow these steps to implement the observer pattern with the eventlistener the events are delivered as non null json strings, which are divided into two properties type and payload for detailed information on the events, refer to the documentation at the following link link steps to implement the observer initialize the observer after setting or injecting nwcore , call the observer called eventlistener to listen for the events parse the json event once an event is received, it will be in the form of a non null json string you need to parse this json string to extract the type and payload components handle event types based on the type of the event, implement the appropriate logic to process or handle the event process payload extract and utilize the data from the payload property as needed for your application by following these steps, you can effectively integrate and handle the events using the nwcore sdk // without di private val nwsdk nwcore by lazy { nwcoreimpl builder(this) build() } // or with di @inject lateinit var nwsdk nwcore nwsdk eventlistener collect { event > // `event` is the json of each event // developer can utilize these events in this collect block timber tag("expevent") d(event) } // in a compose function val scope = remembercoroutinescope() val guieventpayload = remember { mutablestateof\<string>("") } launchedeffect(unit) { scope launch { nwsdk eventlistener collect { event > // `event` is the json of each event // developer can utilize these events in this collect block timber tag("expevent") d(event) guieventpayload value = event } } }