# Handling URL Scheme

To receive incoming deep-link to your RedirectURL from the trusted webview, you need to add some setup your project.

{% tabs %}
{% tab title="Android" %}
You can check this [complete guide on deep-links in Android](https://developer.android.com/training/app-links/deep-linking).

### Add Intent Filter to Receive Incoming Link

Here's an example on receiving an incoming link of `cotterexample://login`

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

```markup
<activity android:name="com.example.cotterexample.Login">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <!-- Accepts URIs that begin with "cotterexample://login" -->
        <data android:scheme="cotterexample"
            android:host="login" />
    </intent-filter>
</activity>
```

{% endcode %}

### Read data from incoming intents <a href="#handling-intents" id="handling-intents"></a>

You should generally do this during [`onCreate()`](https://developer.android.com/reference/android/app/Activity.html#onCreate\(android.os.Bundle\)) or [`onStart()`](https://developer.android.com/reference/android/app/Activity.html#onStart\(\))

```java
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Read data from incoming intents 
    Intent intent = getIntent();
    if (Intent.ACTION_VIEW.equals(intent.getAction())) {
        Uri uri = intent.getData();
        // Use this data to perform your http request to get Cotter token 
        String authCode = uri.getQueryParameter(AUTH_CODE);
        String state = uri.getQueryParameter(STATE);
        String challengeID = uri.getQueryParameter(CHALLENGE_ID);
    }
}
```

{% endtab %}

{% tab title="Second Tab" %}

{% endtab %}
{% endtabs %}


---

# 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://docs.cotter.app/sdk-reference/api-for-other-mobile-apps/api-for-mobile-apps/handling-url-scheme.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.
