Get started with the Flutter SDK
The Adjust Flutter SDK enables you to measure attribution, events, and much more in your Flutter app. Follow the steps in this guide to set up your app to work with the Adjust SDK. You can also check out our example apps on GitHub.
To use the Adjust Flutter SDK in your Flutter app, you need to add it to your project.
To import the Adjust SDK to your Flutter project, follow these steps:
- Add the following to your
- Navigate to your project and run the following command. Visual Studio automatically runs this command after you edit the
Apps that target the Google Play Store must use the Google Advertising ID (
gps_adid) to identify devices. To do this, Add the following dependency to the
dependencies section of your
The Adjust SDK requires the following permissions. Add them to your
AndroidManifest.xml file if they are not already present:
The Adjust SDK includes the
com.google.android.gms.AD_ID permission by default in version 4.32.0 and above. You can remove it by adding a
remove directive if need to make your app COPPA-compliant or if you do not target the Google Play Store.
See Google's AdvertisingIdClient.Info documentation for more information about this permission.
If you are using Proguard, add the following rules to your custom Proguard file.
If you are not publishing your app in the Google Play Store, add the following rule to your Proguard file.
The install referrer is a unique identifier which you can use to attribute an app install to a source. The Adjust SDK requires this information to perform attribution. There are three methods you can use to gather this information:
- Use the Google Play Referrer API.
- Listen for the
INSTALL_REFERRERintent with a broadcast receiver.
- Use the Huawei Referrer API (only for Huawei devices).
INSTALL_REFERRER intent method of delivering referrer information for Google Play Services. If you are currently using this method, migrate to the Google Play Referrer API.
The Adjust SDK is able to get extra information when you include certain iOS frameworks in your app. These frameworks enable certain SDK features, but they are not madatory for the SDK to work. You can add the frameworks and then mark them as optional in Project Settings > Build Phases > Link Binary With Libraries.
Make sure you initialize the Adjust SDK as soon as possible in your Flutter app. To do this, initialize your config object with your app token and the environment you want to run your application in.
AdjustEnvironment.sandbox. Change this to
AdjustEnvironment.production before you submit your application to the app store.
You need to set up session tracking so that the SDK can pass session information to the Adjust backend.
To set up session tracking for Android devices, call the
Adjust.onResume() method when the app is running in the foreground and make a call to the
Adjust.onPause() method when the app is not running in the foreground. You can do this globally or per widget.
Well done! You should now be able to build and run your Flutter app. Enable logging to check for any issues. Check your logs to see the
Install tracked message.
You are ready to start attributing your users with the Adjust SDK.
You can use the Adjust SDK signature to sign all communications sent by the Adjust SDK. This enables Adjust’s servers to detect and reject any install activity that is not legitimate.
To get started with the Adjust SDK signature, contact your Technical Account Manager or firstname.lastname@example.org.
The Adjust SDK provides tools for testing and troubleshooting issues with your integration. To test your setup: