# Widget and In-App Messages

### Pop-up and In-App Message Presentation Behavior

All push notifications in Netmera work automatically—no additional coding is required. However, you can **customize** pop-up presentations and **listen to push callbacks**.

By default, when a popup notification or in-app message is received:

* If the app is in the **foreground**, the SDK displays pop-up notifications and in-app messages **immediately**.
* If the app is in the **background**, the SDK shows them **when the app returns to the foreground.**

### Receiving Popups and In-App Messages in the Background

To receive popups or in-app messages when the application is in the background, you need to enable **Remote Notifications** under **Background Modes** in **Capabilities**.

<figure><img src="/files/ITaiEiIz6Ls9AtvqP5U1" alt=""><figcaption></figcaption></figure>

### Pop-up Presentation Logic

If a pop-up is received when pop-up presentation is disabled by your code, SDK will store it, and present whenever pop-up presentation is re-enabled. If multiple pop-up notifications are received during that period, SDK stores the most recent notification, and present only that one.

### Managing Pop-up Presentations <a href="#enable-disable-immediate-presentations" id="enable-disable-immediate-presentations"></a>

To enable or disable pop-up presentation, you need to call this methods

To show pop-up on the app start or everywhere in the app, please call `Netmera.enablePopupPresentation();` to your `index.js` file.

```typescript
 Netmera.enablePopupPresentation();
```

```typescript
 Netmera.disablePopupPresentation();
```

#### Handle Widget URL's <a href="#handle-widget-urls" id="handle-widget-urls"></a>

**Step 1:** In order to use the widget URL callback, add these lines into `AppDelegate.swift` file.

<pre class="language-swift"><code class="lang-swift"><strong>import NetmeraNotification
</strong>
...
  override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    ...
    //Call right after RNNetmera.initNetmera()
<strong>    Netmera.setPushDelegate(self)
</strong>    ..
  }
...

<strong>extension AppDelegate: NetmeraPushDelegate {
</strong><strong>    func urlOpeningDecision(for url: URL, push: NetmeraBasePush) -> PushDelegateDecision {
</strong><strong>        return .sdkHandles
</strong><strong>    }
</strong><strong>    
</strong><strong>    func openURL(_ url: URL, for push: NetmeraBasePush) {
</strong><strong>        RNNetmeraRCTEventEmitter.openURL(url: url, forPushObject: push)
</strong><strong>    }
</strong><strong>}
</strong></code></pre>

No need extra implementation for Android.

**Step 2:** Handle widget URL's in React Native.

```typescript
void _onWidgetUrlTriggered(String url) {
  // Handle widget URL
}

Netmera.onWidgetUrlTriggered(_onWidgetUrlTriggered);
```


---

# Agent Instructions: 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:

```
GET https://user.netmera.com/netmera-developer-guide/platforms/react-native/push-notifications/widget-and-in-app-messages.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
