> For the complete documentation index, see [llms.txt](https://user.netmera.com/netmera-developer-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://user.netmera.com/netmera-developer-guide/platforms/react-native/push-notifications/push-callbacks.md).

# Push Callbacks

Netmera provides the following push notification callbacks:

* **Push Register**: Triggered when a device registers for push notifications.
* **Push Receive**: Triggered when a push notification is received.
* **Push Open**: Triggered when a user taps the notification.
* **Push Dismiss ( only Android )**: Triggered when a user dismisses the notification.&#x20;
* **Push Button Click**: Triggered when a user interacts with a button inside the notification.
* **Carousel Object Select**: Triggered when a user selects an item in a carousel notification.

To enable these callbacks in your React Native project, follow the steps below:

### Step 1: Create `NetmeraPushHeadlessTask.ts`

* Create a new file named `NetmeraPushHeadlessTask.ts` in your React Native project and define the callback functions:

```typescript
import {
  NetmeraPushObject,
  NetmeraInteractiveAction,
  NetmeraCarouselObject
} from "react-native-netmera";

export const onPushRegister = async (data: { pushToken: string }) => {
  console.log('onPushRegister: ', data);
};

export const onPushReceive = async (push: NetmeraPushObject) => {
  console.log('onPushReceive: ', push);
};

export const onPushOpen = async (push: NetmeraPushObject) => {
  console.log('onPushOpen: ', push);
};

export const onPushDismiss = async (push: NetmeraPushObject) => {
  console.log('onPushDismiss: ', push);
};

export const onPushButtonClicked = async (
  push: NetmeraPushObject,
  action?: NetmeraInteractiveAction
) => {
  console.log('onPushButtonClicked: ', push);
  console.log('Clicked action: ', action);
};

export const onCarouselObjectSelected = async (
  push: NetmeraPushObject,
  carouselItem?: NetmeraCarouselObject
) => {
  console.log('onCarouselObjectSelected: ', push);
  console.log('Selected carousel item: ', carouselItem);
};
```

### Step 2: Register Callbacks in `index.js`

* In your `index.js` file, import the callback functions and call `setPushLifecycleCallbacks`:

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

Netmera.setPushLifecycleCallbacks(
    onPushRegister,
    onPushReceive,
    onPushOpen,
    onPushDismiss,
    onPushButtonClicked,
    onCarouselObjectSelected
);

// Ensure this is called after `Netmera.setPushLifecycleCallbacks`
AppRegistry.registerComponent(appName, () => App);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://user.netmera.com/netmera-developer-guide/platforms/react-native/push-notifications/push-callbacks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
