Push Callbacks
Initializing Netmera SDK with Callbacks
When initializing Netmera, you can register different types of callbacks:
In-App Message Callbacks (
.nmInAppMessageActionCallbacks())Push Action Callbacks (
.nmPushActionCallbacks())Web Widget Callbacks (
.nmWebWidgetCallbacks())
Step 1: Initialize Netmera SDK with Callbacks
During the initialization of Netmera, specify which callbacks your app should handle and include the callback lines during the initialization step (Step 5: Initialize Netmera SDK).
.nmInAppMessageActionCallbacks().nmPushActionCallbacks().nmWebWidgetCallbacks()
override fun onCreate() {
super.onCreate()
val configBuilder = NetmeraConfiguration.Builder()
.apiKey(apiKey)
.firebaseSenderId(PropertiesUtil.gcmSenderId)
.huaweiSenderId(PropertiesUtil.hmsSenderId) // For Huawei services
.logging(true) // Enables Netmera logs in Logcat
.nmInAppMessageActionCallbacks(NGInAppMessageActionCallbacks()) // In-App Message Callback
.nmPushActionCallbacks(NGPushActionCallbacks()) // Push Action Callback
.nmWebWidgetCallbacks(NGWebWidgetCallbacks()) // Web Widget Callback
Netmera.init(configBuilder.build(this))
}Step 2: Implement a Receiver Class
Extend
NetmeraPushBroadcastReceiverand override the necessary callback methods. Avoid usingToastmessages in the production environment.
In-App Action Calllback
To trigger an in-app callback, select the banner style in the Netmera control panel.
The pop-up style will not trigger the callback.
Push Action Calllback
Widget Callback Methods
Implement the
NMWebWidgetCallbacksinterface and override theonDeeplinkTriggered()andonOpenUrlTriggered()methods.

Last updated
Was this helpful?