# Sdk Integration

## Configure project

To use the Netsocks SDK in Flutter, it is necessary to declare the SDK inside the `dependencies` block of the `pubspec.yaml` file of your app:

```yaml
dependencies:
  netsocks: ^1.0.0-rc05
```

Then, you have to run the following command to install the SDK in your project:

```bash
$ flutter pub get
```

That's all. You can now use `import` to access the SDK functionalities:

```dart
import 'package:netsocks/netsocks.dart';
```

***

## Configure Manifest with the necessary permissions

**Our SDK does not collect any personal information from your users**, so no special permission is needed for our SDK to work, so you only need to add the internet permission.

To do so, you have to add the following line in the `android/app/src/main/AndroidManifest.xml` file inside the `<manifest..>..` block

```markup
<uses-permission android:name="android.permission.INTERNET"/>
```

{% hint style="warning" %}
It is possible that you have already added this permission before, in case you already have it, it is not necessary to add it again.
{% endhint %}

***

## User's consent

In some countries, it is necessary to obtain the user's consent in order to obtain revenues with their Internet connection. You can implement your own consent screen for this purpose and call the SDK's activation or deactivation methods depending on the user's response.

***

## Initialize/activate SDK

{% hint style="info" %}
Remember that your PUBLISHER-KEY is located in the Netsocks portal. To view it click on '**Add new application**'. Or check the [Publisher Key](https://docs.netsocks.io/portal/publisher-key) section.
{% endhint %}

To initialize and/or activate the SDK, you need to add the following code inside the `initState()` method of your application:

```dart
await Netsocks.enable('PUBLISHER-KEY');
```

{% hint style="success" %}
Applications will be automatically added to your portal when the SDK is integrated and activated for the first time, this is thanks to our **1 STEP INTEGRATION** technology, so you can focus on what really matters 🥰.
{% endhint %}

***

## Deactivate SDK

In order to disable the SDK, you can call the following method.

```dart
await Netsocks.disable();
```

{% hint style="info" %}
It is correct to call this function if in your consent implementation, the user rejected your request. This function permanently disables the SDK until you call the activation method again.
{% endhint %}
