---
metadata:
  - name: generator
    content: Diplodoc Platform v5.39.1
alternate:
  - https://yandex.com/dev/contentblocker/doc/en/dg/concepts/adjustment.md
  - https://yandex.com/dev/contentblocker/doc/ru/dg/concepts/adjustment.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/contentblocker/doc/en/llms.txt

# Configuring interaction with the Content Blocking API

## How data is exchanged between the browser and the extension {#process-description}

1. Yandex.Browser scans the [manifests](https://developer.android.com/guide/topics/manifest/manifest-intro.html) of all applications installed on the device. If your extension's manifest meets the [requirements](#filters-requirements), the browser adds it to the list of extensions for blocking content.
1. Your extension can open the content blocking settings in the user's browser by [sending](#additional-settings) the corresponding [Intent](https://developer.android.com/reference/android/content/Intent.html#Intent).
1. After the user has chosen your extension in the settings, the browser caches the content blocking filters from the extension. Since filters are cached, the extension must promptly [inform](#update-filters) the browser of any changes to filters.
1. The browser begins blocking content on web pages according to the filtering rules.

## Configuring the extension's manifest {#filters-requirements}

In order for Yandex.Browser to get filters from your extension:

1. The content provider section in the [AndroidManifest.xml](https://developer.android.com/guide/topics/manifest/manifest-intro.html) file should look like this:

    ```text
   <[provider](*provider)
       android:name="<package_name>.sampleContentProvider"       
       android:authorities="<package_name>.contentBlocker.contentProvider"       
       android:exported="true">       
   </provider>
    ```
    
    Attribute descriptions (all attributes are required):
    
    - **[android:name](https://developer.android.com/guide/topics/manifest/provider-element.html#nm)** — Name of the data provider class in any format.

        Example:
    
        `android:name="my.content.blocker.FiltersContentProvider"`
    
    - **[android:authorities](https://developer.android.com/guide/topics/manifest/provider-element.html#auth)** — The URI for the browser to access your [ContentProvider](https://developer.android.com/reference/android/content/ContentProvider.html). It must conform strictly to the pattern: `<package_name>.contentBlocker.contentProvider`.

        Example:
    
        `android:authorities="my.content.blocker.contentBlocker.contentProvider"`
    
    - **[android:exported](https://developer.android.com/guide/topics/manifest/provider-element.html#exported)** — Defines whether your data is available to other applications. Set the value to `true`, implying that the filters are available to other applications.

        Example:
    
        `android-exported="true"`
    
1. The [AndroidManifest.xml](https://developer.android.com/guide/topics/manifest/manifest-intro.html) file must include information about the version of the Content Blocker API:
    ```text
    <[meta-data](*meta-data) android:name="com.samsung.android.sbrowser.contentBlocker.interfaceVersion" android:value="API_1.0" />
    ```
    
    Attribute descriptions (all attributes are required):
    
    - **[android:name](https://developer.android.com/guide/topics/manifest/meta-data-element.html#nm)** — Metatag name. Must exactly match the name in the example (this is necessary for compatibility with [Samsung Internet for Android](http://developer.samsung.com/internet/android/extension-guide.html)).

        Example:
    
        `android:name="com.samsung.android.sbrowser.contentBlocker.interfaceVersion"`
    
    - **[android:value](https://developer.android.com/guide/topics/manifest/meta-data-element.html#val)** — Version number of the Content Blocker API for mobile browsers that the extension should work with.

        Example:
    
        `android:value="API_1.0"`
    
        {% note info %}
    
        The current version of the Content Blocker API is 1.0.
    
        {% endnote %}
    

## Updating filters {#update-filters}

Yandex.Browser checks extension versions on each launch. If the extension version changed, the browser repeats the request for filters from the extension.

In order for filters in the browser cache to be updated without delay, the extension can notify the browser of updated filters immediately after they are changed.

To do this, send a [Broadcast message](https://developer.android.com/reference/android/content/BroadcastReceiver.html) with the [Intent](https://developer.android.com/reference/android/content/Intent.html#Intent) object in the format:

```javascript
Intent intent = new Intent();       
       intent.setAction("com.samsung.android.sbrowser.contentBlocker.ACTION_UPDATE");       
       intent.setData(Uri.parse("package:<package_name>"));       
       sendBroadcast(intent);
```

Example:

```javascript
Intent intent = new Intent();
       intent.setAction("com.samsung.android.sbrowser.contentBlocker.ACTION_UPDATE");
       intent.setData(Uri.parse("package:my.content.blocker"));
       sendBroadcast(intent);
```

More detailed about attributes:
* [setAction](https://developer.android.com/reference/android/content/Intent.html#setAction%28java.lang.String%29);
* [setData](https://developer.android.com/reference/android/content/Intent.html#setData%28android.net.Uri%29) ([Uri.parse](https://developer.android.com/reference/android/net/Uri.html#parse%28java.lang.String%29));
* [sendBroadcast](https://developer.android.com/reference/android/content/Context.html#sendBroadcast%28android.content.Intent%29).

## Opening browser settings after installing the extension {#additional-settings}

Immediately after installation, your extension can open Yandex.Browser settings on the device and ask the user to select the extension for blocking content. To do this:

1. Create an [Intent](https://developer.android.com/reference/android/content/Intent.html#Intent) and set the following string as the activity: 

   `intent.setAction("com.samsung.android.sbrowser.contentBlocker.ACTION_SETTING")`.
1. Call the [startActivity](https://developer.android.com/reference/android/content/Context.html#startActivity%28android.content.Intent%29) method for the [Context](https://developer.android.com/reference/android/content/Context.html) class.

```javascript
 Intent intent = new Intent();
       intent.setAction("com.samsung.android.sbrowser.contentBlocker.ACTION_SETTING");
       startActivity(intent);
```
More detailed about attributes:
* [setAction](https://developer.android.com/reference/android/content/Intent.html#setAction%28java.lang.String%29);
* [startActivity](https://developer.android.com/reference/android/content/Context.html#startActivity%28android.content.Intent%29).

[*provider]:A [wrapper](https://developer.android.com/guide/topics/manifest/provider-element.html) that gives other applications access to your data.

[*meta-data]:The extension's [metadata](https://developer.android.com/guide/topics/manifest/meta-data-element.html).