> For the complete documentation index, see [llms.txt](https://docs.hackle.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hackle.io/en/development-guide/android/android-deeplink/android-deeplink-os.md).

# Basic Deep Link Integration

## Default Behavior

The SDK opens links with Android's `ACTION_VIEW` Intent.\
Android finds the Activity that handles the link based on Intent filters.

<table><thead><tr><th width="260">Link</th><th>Behavior</th></tr></thead><tbody><tr><td>Push Message link</td><td><p>Starts the Intent with the following flags.</p><ul><li><code>FLAG_ACTIVITY_NEW_TASK</code></li><li><code>FLAG_ACTIVITY_CLEAR_TOP</code></li><li><code>FLAG_ACTIVITY_SINGLE_TOP</code></li></ul><p>If no Activity can open the link, the SDK starts the launcher Activity with the link in its data.</p></td></tr><tr><td>In-App Message link</td><td>Starts the Intent from the current screen.<br>If the link cannot be opened, the SDK only writes a log.</td></tr></tbody></table>

## Link Receive Settings

Add an Intent filter to the Activity that receives links in `AndroidManifest.xml`.\
If you set `launchMode` to `singleTask`, links received while the app is running are delivered to the same Activity's `onNewIntent`.

{% code title="AndroidManifest.xml" %}

```xml
<activity
    android:name=".ExampleActivity"
    android:launchMode="singleTask"
    android:exported="true">
    <!-- Deep link -->
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="myapp" />
    </intent-filter>

    <!-- App Links -->
    <intent-filter android:autoVerify="true">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="https" android:host="example.com" />
    </intent-filter>
</activity>
```

{% endcode %}

{% hint style="info" %}
To use App Links, an `assetlinks.json` file must be hosted on the web server of the domain.\
For details, see the [Android Deep Link Guide](https://developer.android.com/training/app-links/deep-linking).
{% endhint %}

## Handle Delivered Link

Links opened by the SDK are delivered to the Activity's Intent.\
Read the link from the Intent in `onCreate` and `onNewIntent` and handle it.

{% tabs %}
{% tab title="Kotlin" %}

```kotlin
import android.app.Activity
import android.content.Intent
import android.os.Bundle

class ExampleActivity : Activity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        if (intent != null && !intent.dataString.isNullOrEmpty()) {
            //  Do something ...
            println("link : ${intent?.dataString}")
        }
    }

    override fun onNewIntent(intent: Intent?) {
        super.onNewIntent(intent)
        setIntent(intent)
        if (intent != null && !intent.dataString.isNullOrEmpty()) {
            //  Do something ...
            println("link : ${intent?.dataString}")
        }
    }
}
```

{% endtab %}

{% tab title="Java" %}

```java
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.Nullable;

public class ExampleActivity extends Activity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Intent intent = getIntent();
        if (intent != null && intent.getDataString() != null) {
            String text = String.format("link : %s", intent.getDataString());
            System.out.println(text);
        }
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
        if (intent != null && intent.getDataString() != null) {
            String text = String.format("link : %s", intent.getDataString());
            System.out.println(text);
        }
    }
}
```

{% endtab %}
{% endtabs %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.hackle.io/en/development-guide/android/android-deeplink/android-deeplink-os.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
