# How to set a custom 'user-agent' as header for Android Bitmovin player SDK?

**URL:** <https://community.bitmovin.com/t/how-to-set-a-custom-user-agent-as-header-for-android-bitmovin-player-sdk/979>\
**Category:** Support\
**Tags:** bitmovin-player, android\
**Created:** [July 5, 2022, 7:53pm UTC](https://community.bitmovin.com/t/how-to-set-a-custom-user-agent-as-header-for-android-bitmovin-player-sdk/979 "2022-07-05T19:53:30Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![daniel](https://sea1.discourse-cdn.com/flex015/user_avatar/community.bitmovin.com/daniel/32/121_2.png) [@daniel](https://community.bitmovin.com/u/daniel)\
**Post date:** [July 5, 2022, 7:55pm UTC](https://community.bitmovin.com/t/how-to-set-a-custom-user-agent-as-header-for-android-bitmovin-player-sdk/979/2 "2022-07-05T19:55:59Z")

</div>

Figured it out - below is a sample to add a custom User-Agent in any HTTP request using `PreprocessHttpRequestCallback` in Java. `customValue` should be replaced with the preferred User-Agent string.

Note: there was a bug in our old Android player SDK (\< 3.17.0) which was the User-Agent overwrite was ignored as described in our release note ([Bitmovin Docs - Player Android / AndroidTV Release 3.17.0](https://bitmovin.com/docs/player/releases/android/android-3-17-0)). So ensure to use version 3.17.0 or later.

```java
NetworkConfig networkConfig = new NetworkConfig();
PreprocessHttpRequestCallback preprocessHttpRequestCallback = new PreprocessHttpRequestCallback() {
    @Nullable
    @Override
    public Future<HttpRequest> preprocessHttpRequest(HttpRequestType httpRequestType, HttpRequest httpRequest) {

        ExecutorService executorService = Executors.newSingleThreadExecutor();
        Callable<HttpRequest> callable = () -> {
            HashMap<String, String> headers = new HashMap<>();
            headers.put("User-Agent", "customValue");
            httpRequest.setHeaders(headers);
            return httpRequest;
        };
        Future<HttpRequest> future = executorService.submit(callable);
        return future;
    }
};
networkConfig.setPreprocessHttpRequestCallback(preprocessHttpRequestCallback);
player.getConfig().setNetworkConfig(networkConfig);

```

---

_[View the full topic](https://community.bitmovin.com/t/how-to-set-a-custom-user-agent-as-header-for-android-bitmovin-player-sdk/979)._
