Basic Setup
Quick start
Example apps
There are example Flutter app inside the example directory. In there you can check how the Adtrace SDK can be integrated.
Add the SDK to your project
You can add Adtrace SDK to your Flutter app by adding following to your pubspec.yaml file:
dependencies:
adtrace_sdk_flutter: ^1.5.0
Then navigate to your project in the terminal and run:
flutter packages get
If you are using Visual Studio Code to develop your app, upon editing pubspec.yaml, it will automatically run this command, so you don't need to run it manually.
Android
Add Google Play Services
Since the 1st of August 2014, apps in the Google Play Store must use the Google Advertising ID to uniquely identify devices.
To allow the Adtrace SDK to use the Google Advertising ID, you must integrate the Google Play Services.
If you haven't done this yet, please add dependency to Google Play Services library by adding following dependency to your dependencies block of app's build.gradle file for
Android platform:
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
The Adtrace SDK is not tied to any specific version of the play-services-ads-identifier part of the Google Play Services library. You can use the latest version of the library, or any other version you need.
Add permissions
Please add the following permissions, which the Adtrace SDK needs, if they are not already present in your AndroidManifest.xml file for Android platform:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
If you are not targeting the Google Play Store, please also add the following permission:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
Add permission to gather Google advertising ID
If you are targeting Android 12 and above (API level 31), you need to add the com.google.android.gms.AD_ID permission to read the device's advertising ID.
Add the following line to your AndroidManifest.xml to enable the permission.
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
For more information, see Google's AdvertisingIdClient.Info documentation.
Proguard settings
If you are using Proguard, add these lines to your Proguard file:
-keep class io.adtrace.sdk.** { *; }
-keep class com.google.android.gms.common.ConnectionResult {
int SUCCESS;
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
java.lang.String getId();
boolean isLimitAdTrackingEnabled();
}
-keep public class com.android.installreferrer.** { *; }
If you are not publishing your app in the Google Play Store, you can leave just io.adtrace.sdk package rules:
-keep public class io.adtrace.sdk.** { *; }