--- title: "Use a Custom OkHttpClient" slug: "mapp-intelligence-android-sdk-v5-custom-okhttp-client" description: "Use a custom OkHttpClient in Mapp Intelligence Android SDK v5 for shared networking setup, interceptors, timeouts, or certificate pinning." updated: 2026-04-24T10:41:11Z published: 2026-04-24T10:41:11Z canonical: "docs.mapp.com/mapp-intelligence-android-sdk-v5-custom-okhttp-client" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.mapp.com/llms.txt > Use this file to discover all available pages before exploring further. # Use a Custom OkHttpClient The Android SDK uses an internal OkHttp client by default. If your app already standardizes networking with a custom [OkHttpClient](https://square.github.io/okhttp/), you can pass that client into the SDK configuration. This is useful when you need custom timeouts, interceptors, logging, certificate pinning, or other shared network settings. ## When to customize the client - Use a custom client when your app already has a shared OkHttp setup that should also apply to tracking requests. - Keep the SDK default client if you do not need custom network behavior. ## Example **Kotlin** ```kotlin class SampleApplication : Application() {    override fun onCreate() {        super.onCreate()        val okHttpClient = OkHttpClient.Builder()            .readTimeout(15, TimeUnit.SECONDS)            .build()        val configuration = WebtrekkConfiguration.Builder(            trackIds = listOf("11111111111111111"),            trackDomain = "https://your-trackdomain.com"        )            .okHttpClient(okHttpClient)            .build()        Webtrekk.getInstance().init(this, configuration)    } } ``` **Java** ```java public class SampleApplication extends Application {    @Override    public void onCreate() {        super.onCreate();        OkHttpClient okHttpClient = new OkHttpClient.Builder()            .readTimeout(15, TimeUnit.SECONDS)            .build();        WebtrekkConfiguration configuration = new WebtrekkConfiguration.Builder(                Arrays.asList("11111111111111111"),                "https://your-trackdomain.com"            )            .okHttpClient(okHttpClient)            .build();        Webtrekk.getInstance().init(this, configuration);    } } ``` ## What stays unchanged Passing a custom OkHttp client changes how the SDK performs network requests, but it does not change your tracking API usage. Tracking setup, events, and request scheduling continue to work through the normal SDK interfaces. ## Notes - Only pass a custom client if you intentionally want the SDK to use your networking configuration. - Make sure the client can reach your track domain without app-specific restrictions. - If you customize timeouts or interceptors, validate the behavior in your app environment before publishing. Related: [Configure Global Tracking](https://docs.mapp.com/docs/en/configure-global-tracking), [Configure WorkManager Constraints](https://docs.mapp.com/docs/en/mapp-intelligence-android-sdk-v5-configure-workmanager-constraints)