---
id: network-plugin
title: Network Setup
sidebar_label: Network
---

To use the network plugin, you need to add the plugin to your Flipper client instance.

## Android

```java
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;

NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
client.addPlugin(networkFlipperPlugin);
```

### OkHttp Integration

If you are using the popular OkHttp library, you can use the Interceptors system to automatically hook into your existing stack.

```java
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;

new OkHttpClient.Builder()
    .addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin))
    .build();
```

As interceptors can modify the request and response, add the Flipper interceptor after all others to get an accurate view of the network traffic.

## iOS

```objective-c
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>

[client addPlugin: [FlipperKitNetworkPlugin new]]
```

---
id: network-plugin
title: Network Setup
sidebar_label: Network
---

To use the network plugin, you need to add the plugin to your Flipper client instance.

## Android

```java
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;

NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
client.addPlugin(networkFlipperPlugin);
```

### OkHttp Integration

If you are using the popular OkHttp library, you can use the Interceptors system to automatically hook into your existing stack.

```java
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;

new OkHttpClient.Builder()
    .addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin))
    .build();
```

As interceptors can modify the request and response, add the Flipper interceptor after all others to get an accurate view of the network traffic.

## iOS

To enable network inspection, add the following pod to your Podfile:

```ruby
pod 'FlipperKit/SKIOSNetworkPlugin', '~>' + flipperkit_version
```

Initialise the plugin in the following way:

<!--DOCUSAURUS_CODE_TABS-->
<!--Objective-C-->
```objective-c
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>

[[FlipperClient sharedClient] addPlugin: [[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];

```
<!--Swift-->
```swift
import FlipperKit

client?.add(FlipperKitNetworkPlugin(networkAdapter: SKIOSNetworkAdapter()))

```
<!--END_DOCUSAURUS_CODE_TABS-->

Update network plugin docs for iOS
Update network plugin docs for iOS

Summary: Updated the installation instruction for the network plugin

Reviewed By: jknoxville

Differential Revision: D15166206

fbshipit-source-id: c30d18cd7ac62c813e368de914b279f466a1f1c1
