# SDK integration

## Setup project

To integrate our SDK for Flutter, it is needed to add the following line inside the `dependencies` block of the `pubspec.yaml` file of your app:

```yaml
dependencies:
  wortise: ^1.7.5
```

Next, execute the following command to proceed with the SDK installation:

```bash
$ flutter pub get
```

Now, you will be able to use the following `import` statements to access the classes provided by the SDK:

```dart
import 'package:wortise/ad_content_rating.dart';
import 'package:wortise/ad_settings.dart';
import 'package:wortise/ad_size.dart';
import 'package:wortise/banner_ad.dart';
import 'package:wortise/consent_manager.dart';
import 'package:wortise/data_manager.dart';
import 'package:wortise/interstitial_ad.dart';
import 'package:wortise/rewarded_ad.dart';
import 'package:wortise/user_gender.dart';
import 'package:wortise/wortise_sdk.dart';
```

## Setup Manifest (Android)

It is needed to add the following `<meta-data>` element in the `android/app/src/main/AndroidManifest.xml` file, inside the `<application>` block, with Google's application ID as value:

```xml
<manifest>
    ...
    <application>
        ...
        <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
    </application>
</manifest>
```

{% hint style="info" %}
This value can be found in our dashboard, inside the app details, under the name `Google App ID`.
{% endhint %}

## Setup Info.plist (iOS)

It is needed to add the following parameter in the `Info.plist` file, with Google's application ID as value:

```xml
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-xxxxxxxxxxxxxxxxxx</string>
```

{% hint style="info" %}
This value can be found in our dashboard, inside the app details, under the name `Google App ID`.
{% endhint %}

Then, it would only be needed to add the following block, in the same file, to complete the correct integration with Google:

```xml
<key>SKAdNetworkItems</key>
<array>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>cstr6suwn9.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4fzdc2evr5.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4pfyvq9l8r.skadnetwork </string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>2fnua5tdw4.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ydx93a7ass.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>5a6flpkh64.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>p78axxw29g.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>v72qych5uu.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ludvb6z3bs.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>cp8zw746q7.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>c6k4g5qg8m.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>s39g8k73mm.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>3qy4746246.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>3sh42y64q3.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>f38h382jlk.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>hs6bdukanm.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>prcb7njmu6.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>v4nxqhlyqp.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>wzmmz9fp6w.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>yclnxrl5pm.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>t38b2kh725.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>7ug5zh24hu.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>9rd848q2bz.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>y5ghdn5j9k.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>n6fk4nfna4.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>v9wttpbfk9.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>n38lu8286q.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>47vhws6wlr.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>kbd757ywx3.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>9t245vhmpl.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>a2p9lx4jpn.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>22mmun2rn5.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4468km3ulz.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>2u9pt9hc89.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>8s468mfl3y.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>av6w8kgt66.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>klf5c3l5u5.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ppxm28t8ap.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>424m5254lk.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>ecpz2srf59.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>uw77j35x4d.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>mlmmfzh3r3.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>578prtvx9j.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>4dzt52r2t5.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>gta9lk7p23.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>e5fvkxwrpn.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>8c4e2ghe7u.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>zq492l623r.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>3rd42ekr43.skadnetwork</string>
    </dict>
    <dict>
    <key>SKAdNetworkIdentifier</key>
    <string>3qcr597p9d.skadnetwork</string>
    </dict>
</array>
```

## Request consent

{% hint style="success" %}
It is **very recommended** to request the user consent to be able to show personalised ads. This will allow to display content of more interest and generate higher revenues.
{% endhint %}

You can consult the following section to implement this request and obtain the user consent: [User consent](/en/flutter-sdk/user-consent.md)

## Initialize SDK

To initialize the SDK, it is needed to add the following code inside the `initState()` method of your app:

```dart
import 'package:wortise/wortise_sdk.dart';

await WortiseSdk.initialize('your app key');
```

## Test mode

To verify the integration, the SDK provides a test mode that allows the app to always receive ads.

Beside the option that is available in our dashboard, you can programatically enable this test mode, from the SDK itself, by using the following code:

```dart
import 'package:wortise/ad_settings.dart';

await AdSettings.setTestEnabled(true);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wortise.com/en/flutter-sdk/sdk-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
