fun init(key: String, context: Context)#Methods
#init
Creates a new Engage instance (required to display elements) using your app ID & the current context.
#createElement
fun createElement(slug: String, target: ViewGroup): UnitCreates an Engage Element and displays it inside a view group of your choice.
#autoCreate
fun autoCreate(filters: List<String>? = null): UnitCreates all elements matching multiple conditions like device, country, custom filters, etc.
#commitPageView
fun commitPageView(): EngageIncrements the page view counter in the device's SharedPreferences for elements with a page view count limit.
You can also use this to base capping on sessions instead of page views:
#config
fun config(key: String, value: Any?, readOnly: Boolean? = null): Engagefun config(options: Map<String, Any?>, readOnly: Boolean? = null): EngageAllows to set some configuration options. See the
configuration options documentation.
#texts
fun texts(key: String, value: String?, readOnly: Boolean? = null, locale: String? = null): Engagefun texts(options: Map<String, String?>, readOnly: Boolean? = null, locale: String? = null): EngageAllows to override some hard coded texts. See the
texts documentation.
#variables
fun variable(name: String, value: Any): Engagefun variable(options: Map<String, Any>): EngageAllows to set custom variables to be replaced inside some text keys. See the
variables documentation.
#on*
fun on*(callback: (data: Any?) -> Unit): AccessAllows you to set a callback to be called when a specific event is triggered (ex: onReady).
See the events documentation.
#off
fun off(event: EngageEvents): EngageAllows to remove a callback previously set with
on*.
Accepted values for event are:Events.READYEvents.SEENEvents.CLICKEvents.FORM_SUBMITEvents.DESTROYEvents.ERROR