Push Callbacks

Netmera offers the following push callbacks:

  • Push Register

  • Push Receive

  • Push Open

  • Push Dismiss

  • Push Button Click

To be notified for one or more of these callbacks, follow the steps below:

Step 1: Create NetmeraPushHeadlessTask.js file

In your React Native project, create a new file called NetmeraPushHeadlessTask.js and define the callback functions:

export const onPushRegister = async (message) => {
    console.log("onPushRegister: ", message);
};

export const onPushReceive = async (message) => {
    console.log("onPushReceive: ", message);
};

export const onPushOpen = async (message) => {
    console.log("onPushOpen: ", message);
};

export const onPushDismiss = async (message) => {
    console.log("onPushDismiss: ", message);
};

export const onPushButtonClicked = async (message) => {
    console.log("onPushButtonClicked: ", message);
};

export const onCarouselObjectSelected = async (message) => {
    console.log("onCarouselObjectSelected: ", message);
};

Step 2: Initialize NetmeraBroadcastReceiver in index.js

In your index.js file, import the callback functions and initialize the NetmeraBroadcastReceiver:

import {
    onCarouselObjectSelected,
    onPushButtonClicked,
    onPushDismiss,
    onPushOpen,
    onPushReceive,
    onPushRegister
} from "./NetmeraPushHeadlessTask";

Netmera.initBroadcastReceiver(
    onPushRegister,
    onPushReceive,
    onPushOpen,
    onPushDismiss,
    onPushButtonClicked,
    onCarouselObjectSelected
)

// This should be called after Netmera.initBroadcastReceiver method.
AppRegistry.registerComponent(appName, () => App);

Last updated