Network events

HttpURLConnection, HttpsURLConnection

Network requests of these clients and libraries, which use these clients as underlying HTTP stack, are intercepted automatically. For other HTTP clients additional actions are required.

OkHttpClient

Okhttp 2.2+ are supported. For okhttp of versions 2.2 - 2.7.5 you need to call method addNetworkLoggingToOkHttpClient():

OkHttpClient client = new OkHttpClient();
Bugsee.addNetworkLoggingToOkHttpClient(client);

For okhttp 3.x you need to call method addNetworkLoggingToOkHttpBuilder():

OkHttpClient.Builder builder = new OkHttpClient.Builder();
OkHttpClient client = Bugsee.addNetworkLoggingToOkHttpBuilder(builder)
    .build();

Retrofit

Retrofit 1.9+ are supported. For Retrofit 1.9, which uses okhttp 2.x, you need to set wrapped OkHttpClient to RestAdapter.Builder:

OkHttpClient client = new OkHttpClient();
Bugsee.addNetworkLoggingToOkHttpClient(client);
RestAdapter restAdapter = new RestAdapter.Builder()                  
    .setClient(new OkClient(client))
    .build();

For Retrofit 2.x, which uses okhttp 3.x you need to set wrapped OkHttpClient to Retrofit.Builder:

OkHttpClient.Builder builder = new OkHttpClient.Builder();
OkHttpClient client = Bugsee.addNetworkLoggingToOkHttpBuilder(builder)
    .build();
Retrofit retrofit = new Retrofit.Builder()               
    .client(client)
    .build();

Picasso

For Picasso 1.x it is necessary to call loader() method:

Picasso picasso = new Picasso.Builder(this)
    .loader(new UrlConnectionLoader(this))
    .build();

For Picasso 2.x it is necessary to call downloader() method:

Picasso picasso = new Picasso.Builder(this)
    .downloader(new UrlConnectionDownloader(this))
    .build();

Glide

Glide uses HttpUrlConnection by default, so it's network events are intercepted automatically.

But if you use OkHttpClient as underlying HTTP stack for Glide, additional actions are required. In this case Glide 3.5+ are supported. First, add class, which extends OkHttpGlideModule class, with overridden registerComponents() method.

class CustomGlideModule extends OkHttpGlideModule {
     @Override
    public void registerComponents(Context context, Glide glide) {
        OkHttpClient client = new OkHttpClient();
        Bugsee.addNetworkLoggingToOkHttpClient(client);
        OkHttpUrlLoader.Factory factory = new OkHttpUrlLoader.Factory(client);
        glide.register(GlideUrl.class, InputStream.class, factory);
    }
}

Then register this class in node in application manifest.

<application>
<meta-data
    android:name="com.example.CustomGlideModule"
    android:value="GlideModule"/>
</application>

Replace "com.example" by package of your class, which extends OkHttpGlideModule.