The Adjust MAUI 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 the example app on GitHub.
1. Get the Adjust SDK
The most straightforward way to install the Adjust SDK is via the NuGet Package Manager. Alternatively, you can add the Adjust SDK as a project reference.
Install NuGet package
There are several ways to install packages using NuGet, depending on your environment and preferences. Whether you use the Package Manager UI, Package Manager Console, .NET CLI, or Visual Studio Code, you can choose the method that works best for you.
Use the NuGet package manager to install the Adjust MAUI SDK into your app.
Once installed, your project file should include the following:
<PackageReference Include="Adjust.Maui.Sdk" Version="5.1.0" />
Since the Adjust SDK supports only Android and iOS, if your project targets additional platforms — such as macOS — you’ll need to conditionally include the SDK for supported targets using an ItemGroup
, like this:
<ItemGroup Condition="$(TargetFramework.StartsWith('net8.0-android')) Or $(TargetFramework.StartsWith('net8.0-ios'))"> <PackageReference Include="Adjust.Maui.Sdk" Version="5.1.0" /></ItemGroup>
Add as a project reference
If you prefer to add the Adjust SDK as a project reference instead of using the NuGet package, you can replace the package identifier with the path to the Adjust SDK project:
<ProjectReference Include="..\maui_sdk\AdjustSdk\AdjustSdk.csproj" />
There is also an alternative project reference that has been found to work well with projects migrated from Xamarin which are using .NET for iOS / Android. You can include it as follows:
<ProjectReference Include="..\maui_sdk\AdjustSdk\AdjustSdk-NonMaui.csproj" />
You can find the latest version of the Adjust MAUI SDK project in its GitHub repository.
2. Set up Android devices
Add Google Play Services
Apps that target the Google Play Store must use the Google Advertising ID (gps_adid
) to identify devices.
Following the same procedure used to integrate the Adjust SDK via NuGet, install the required Microsoft package that provides the necessary bindings.
Once installed, your project file should include the following entry:
<PackageReference Include="Xamarin.GooglePlayServices.Ads.Identifier" Version="118.2.0.1" />
Add permissions
AndroidManifest.xml
file where you can add permissions is usually located in the Platforms/Android
directory of your app.
The Adjust SDK requires certain permissions to access information.
INTERNET
: Added automatically by the Adjust SDK. You don’t need to add it manually.
You can also add optional permissions that allow you to access additional information.
ACCESS_NETWORK_STATE
(Optional): You can add this to yourAndroidManifest.xml
file to read certain parameters that might be useful for you.
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
The Adjust SDK includes the com.google.android.gms.AD_ID
permission by default. You can remove it by adding a remove
directive if need to make your app COPPA-compliant or if you don’t target the Google Play Store.
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
Set up install referrer
The install referrer is a unique identifier that helps attribute an app install to its source. The Adjust SDK relies on this information to perform accurate attribution. This data can be obtained using the Google Play Referrer API.
Following the same procedure used to integrate the Adjust SDK via NuGet, install the required Microsoft package that provides the necessary bindings.
Once installed, your project file should include the following:
<PackageReference Include="Xamarin.Google.Android.InstallReferrer" Version="2.2.0.2" />
Collect App Set Identifier
The App Set Identifier is a unique identifier that allows you to measure data across any of your apps installed on a user’s device. All apps published by the same developer share the same App Set ID, enabling you to gain meaningful insights from users across your app portfolio.
To access a device’s App Set ID, install the corresponding Microsoft package that provides the required bindings.
Once installed, your project file should include the following:
<PackageReference Include="Xamarin.GooglePlayServices.AppSet" Version="116.1.0.4" />
3. Set up iOS devices
iOS frameworks
The Adjust SDK automatically weakly links the following frameworks on iOS devices:
Framework | Description | Notes |
---|---|---|
AdSupport.framework | Enables access to the device’s IDFA. Also enables access to LAT information on devices running iOS 14 or earlier. | Don’t add this framework if your app targets the “Kids” category. |
AdServices.framework | Handles ASA attribution. | |
StoreKit.framework | Enables access to the SKAdNetwork framework. | Required to allow the Adjust SDK to handle communication with SKAdNetwork on devices running iOS 14 or later. |
AppTrackingTransparency.framework | Required to allow the Adjust SDK to wrap user ATT consent dialog and access consent responses on devices running iOS 14 or later | Don’t add this framework if your app targets the “Kids” category |
If you prefer not to weakly link any of these frameworks with your iOS app, you can add the Adjust SDK as a project reference. Then, you can either remove all the frameworks — or only specific ones — by modifying the AdjustSdk.iOSBinding.csproj
file. To remove all weak frameworks, delete the following line:
<WeakFrameworks>AdSupport AdServices AppTrackingTransparency StoreKit</WeakFrameworks>
4. Initialize the Adjust SDK
Make sure you initialize the Adjust SDK as soon as possible in your app. To do this, initialize your config object with your app token and the environment you want to run your application in.
In case you are planning to initialize the SDK in platform-specific files, you can do this inside of:
Platforms/Android/MainApplication.cs
file for AndroidPlatforms/iOS/AppDelegate.cs
file for iOS- your
MainPage.xaml.cs
file if you want to initialize it in the code that runs on both platforms
5. Build your app
Well done! You should now be able to build and run your 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.