The best way to install the Requestly Android SDK is with a build system like Gradle. This ensures you can easily upgrade to the latest versions.
RQInterceptor is distributed through Maven Central. To use it you need to add the following Gradle dependency to your build.gradle file of you android app module (NOT the root file)
To configure the Interceptor, you need to initialize the RQCollector with your SDK Key (Steps to generate) and then add rqInterceptor as the last interceptor on okHttpClient
okHttp
1
val collector = RQCollector(context=appContext, sdkKey="<your-sdk-key>")
2
3
val rqInterceptor = RQInterceptor.Builder(appContext)
4
.collector(collector)
5
.build()
6
7
val client = OkHttpClient.Builder()
8
.addInterceptor(rqInterceptor)
9
.build()
Copied!
Retrofit
1
Retrofit.Builder()
2
.baseUrl(APIUtils.API_BASE_URI)
3
.client(okHttpClient) // okHttpClient with RQInterceptor