Push Callbacks

Initializing Netmera SDK with Callbacks

When initializing Netmera, you can register different types of callbacks:

  1. In-App Message Callbacks (.nmInAppMessageActionCallbacks())

  2. Push Action Callbacks (.nmPushActionCallbacks())

  3. 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 NetmeraPushBroadcastReceiver and override the necessary callback methods. Avoid using Toast messages 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 NMWebWidgetCallbacks interface and override the onDeeplinkTriggered() and onOpenUrlTriggered() methods.

Netmera Panel Settings:

  • Select "Widget" Style: Ensure the widget is set to "Widget" style in the Netmera panel to trigger the callback.

  • Choosing "Manage App": If the action should be handled within the app, select "Manage App" when assigning an action in "Create New Widget." Without this, the SDK will handle it, but the callback won't trigger.

Manage App Chosen

Last updated

Was this helpful?