Handling Custom In-App HTML

In order to use custom HTML option for In-app messages, you must implement the InAppCustomHTMLListener and call smartech.setInAppCustomHTMLListener() method in your application class.

public class MyApplication extends Application implements InAppCustomHTMLListener {
    @Override
    public void onCreate() {
        super.onCreate();
        Smartech smartech = Smartech.getInstance(new WeakReference<>(this));
        smartech.initializeSdk(this);
        smartech.setInAppCustomHTMLListener(this);
        ....
    }

    @Override
    public void customHTMLCallback(@Nullable HashMap<String, Object> payload) {
        // Handle In-App HTML callback.
    }
}
class SampleApplication : Application(), InAppCustomHTMLListener {
    override fun onCreate() {
        super.onCreate()
        val smartech: Smartech = Smartech.getInstance(WeakReference(this))
        smartech.initializeSdk(this)
        smartech.setInAppCustomHTMLListener(this)
        ...
    }

    override fun customHTMLCallback(payload: HashMap<String, Any>?) {
        // Handle custom HTML callback.
    }
}

Did this page help you?