> For the complete documentation index, see [llms.txt](https://docs.bird.com/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bird.com/api/client-sdks/sdk-integration/android-sdk/notification-interactions.md).

# Notification Interactions

A user can interact with a notification by:

* Tapping the notification
* Clicking one of the buttons on the notification

The result of any of those interactions depends on the action you select on the [Notification Message Template](https://docs.bird.com/applications/content/message-templates/concepts/push-notifications). There are three options:

* **Open App:** launches the main activity.
* **Open Deep Link:** launches an activity using an intent with `action` set to `Intent.ACTION_VIEW` and the `data` field set to the deep link. If this deep link can be handled by an activity in your application, that activity will be launched with the intent. Otherwise, he launched activity will depend on the installed applications on the device.
* **Open URL:** launches an activity using an intent with `action` set to `Intent.ACTION_VIEW` and the `data` field set to the url. The actual activity that is launched depends on the url and the installed applications on the device. In most cases, urls with http/https scheme will be opened in the browser.

## Handling all notification Interactions

If you need to capture all notification interactions, you can implement a `BroadcastReceiver` and register it with an `<intent-filter>` to receive all intents with action `com.bird.broadcast.NOTIFICATION` .

You can also access the custom payload on all notification interaction captured in `BroadcastReceiver` using `bird.notifications.getNotificationInteraction(intent)` .

Create `BroadcastReceiver` :&#x20;

```kotlin
class MyBroadcastReceiver : BroadcastReceiver() {
 
    override fun onReceive(context: Context, intent: Intent) {
        when (intent.action) {
            "com.bird.broadcast.NOTIFICATION" -> handleNotificationInteractionIntent(
                context,
                intent
            )
        }
    }

    private fun handleNotificationInteractionIntent(context: Context, intent: Intent) {
        val bird = Bird(context)
        val notificationInteraction = bird.notifications.getNotificationInteraction(intent)
    }
}


```

Register your `BroadcastReceiver` as a `<receiver>` inside your `AndroidManifest.xml`:&#x20;

```xml
<application>

    <!-- Add <receiver> inside <application> -->
    <receiver
        android:name=".MyBroadcastReceiver"
        android:exported="false">
        <intent-filter>
            <action android:name="com.bird.broadcast.NOTIFICATION" />
        </intent-filter>
    </receiver>
    
</application>
```

## Deep Links

In order to receive deep links into your main activity (or another activity), you need to define an `<intent-filter>` on your main activity (or another activity) as follows.

```xml
<activity
    android:name=".MainActivity"
    android:exported="true">

    <!-- Add this intent-filter for deep linking -->
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        
        <!-- You can add various conditions here: scheme, host, pathPrefix, etc -->
        <data android:scheme="something" />
    </intent-filter>

</activity>
```

You can specify various filters including `scheme`, `host`, `pathPrefix`, etc. Read more about [Creating deep links in Android](https://developer.android.com/training/app-links/deep-linking).

## Custom Payload

You can set a custom payload on the [Notification Message Template](https://docs.bird.com/applications/content/message-templates/concepts/push-notifications) to be delivered to your app. You can capture custom payload in two places:

* When a notification interaction is received by a `BroadcastReceiver`. See [above](#capture-all-notification-interactions).
* When a deep link launches your activity.

&#x20;In both cases, you can get the custom payload by using the method `bird.notifications.getNotificationInteraction(intent)` . The custom payload exists on `notificationInteraction.payload`.

Here is how it looks like when a deep link launches your activity:

```kotlin
class MainActivity : ComponentActivity() {
    private var bird: Bird? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        bird = Bird(applicationContext)
        super.onCreate(savedInstanceState)

        val notificationInteraction = bird?.notifications?.getNotificationInteraction(intent)
        notificationInteraction?.payload
    }

    override fun onNewIntent(intent: Intent?) {
        super.onNewIntent(intent)
        intent?.let {
            val notificationInteraction = bird?.notifications?.getNotificationInteraction(intent)
            notificationInteraction?.payload
        }
    }
}
```


---

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

```
GET https://docs.bird.com/api/client-sdks/sdk-integration/android-sdk/notification-interactions.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.
