AppsFlyerXamarinBinding 6.13.1
dotnet add package AppsFlyerXamarinBinding --version 6.13.1
NuGet\Install-Package AppsFlyerXamarinBinding -Version 6.13.1
<PackageReference Include="AppsFlyerXamarinBinding" Version="6.13.1" />
paket add AppsFlyerXamarinBinding --version 6.13.1
#r "nuget: AppsFlyerXamarinBinding, 6.13.1"
// Install AppsFlyerXamarinBinding as a Cake Addin #addin nuget:?package=AppsFlyerXamarinBinding&version=6.13.1 // Install AppsFlyerXamarinBinding as a Cake Tool #tool nuget:?package=AppsFlyerXamarinBinding&version=6.13.1
Xamarin iOS Binding
Xamarin Binding integration guide For iOS
AppsFlyer Xamarin Binding version v6.13.0
<br>
Built with AppsFlyer iOS SDK v6.13.0
❗ v6 Breaking Changes
We have renamed some of the APIs. For more details, please check out our Help Center
Overview
AppsFlyer SDK provides app installation and event logging functionality. We have developed an SDK that is highly robust (7+ billion SDK installations to date), secure, lightweight and very simple to embed.
You can measure installs, updates and sessions and also log additional in-app events beyond app installs (including in-app purchases, game levels, etc.) to evaluate ROI and user engagement levels.
AppsFlyer’s Xamarin binding provides application installation and events logging functionality.
The API for the binding coincides with the native iOS API, which can be found here.
Table of content
Nuget
Install-Package AppsFlyerXamarinBinding <br> https://www.nuget.org/packages/AppsFlyerXamarinBinding
Quick Start
Adding the Plugin to your Project
1. Go to Project > Add NuGet Packages...
2. Select the AppsFlyerXamarinBinding
3. Select under version - 6.9.2
4. Click `Add Package`
To Embed SDK into your Application Manually:
1. Copy AppsFlyerXamarinBinding.dll into your project.
2. On Xamarin Studio go to References and click on Edit References.
3. Go to .Net Assembly tab and click on Browse… button.
4. Locate AppsFlyerXamarinBinding.dll and chose it.
API Methods
SDK Initialization
Go to your AppDelegate.cs and add:
using AppsFlyerXamarinBinding;
at the top of the file.Add the following code to the FinishedLaunching() method:
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
AppsFlyerLib.Shared.AppleAppID = "<APP_ID>";
AppsFlyerLib.Shared.AppsFlyerDevKey = "<YOUR_DEV_KEY>";
/* AppsFlyerLib.Shared.Delegate = af_delegate; */
/* AppsFlyerLib.Shared.IsDebug = true; */
return true;
}
- Add the following code in the OnActivated method:
public override void OnActivated(UIApplication application)
{
AppsFlyerLib.Shared.Start();
}
Logging In-App Events
Logging in-app events is performed by calling LogEvent
with event name and value parameters. See In-App Events documentation for more details.
Event Example:
var addToCartEvent = new NSDictionary(AFEventParameter.AFEventParamContentId, "id 1",
AFEventParameter.AFEventParamContentType, "type 1",
AFEventParameter.AFEventParamCurrency, "USD",
AFEventParameter.AFEventParamDescription, "description");
AppsFlyerLib.Shared.LogEvent(AFEventName.AFEventAddToCart, addToCartEvent);
Get Conversion Data
First add to the class-level declarations:
AppsFlyerLibDelegate af_delegate = new AppsFlyerConversionDataDelegate();
Then set up the delegate in FinishedLaunching:
AppsFlyerLib.Shared.Delegate = af_delegate;
AppsFlyerConversionDataDelegate.cs can be found here:
public class AppsFlyerConversionDataDelegate : AppsFlyerLibDelegate
{
public override void OnAppOpenAttribution(NSDictionary attributionData)
{
Console.WriteLine("deeplink data in xamarin = " + attributionData.Description);
}
public override void OnAppOpenAttributionFailure(NSError error) { }
public override void OnConversionDataSuccess(NSDictionary conversionInfo)
{
Console.WriteLine("conversion data in xamarin = " + installData.Description);
}
public override void OnConversionDataFail(NSError error) { }
}
Opt-Out
For complete opt out of the SDK use the following method call
AppsFlyerLib.Shared.IsStopped = true;
This will prevent any data from being sent out of the AppsFlyer SDK.
User invite
Allowing your existing users to invite their friends and contacts as new users to your app can be a key growth factor for your app. AppsFlyer allows you to attribute and record new installs originating from user invites within your app. Set the OneLink ID, before calling Start().
AppsFlyerLib.Shared.AppInviteOneLinkID = "<OneLinKID>";
AppsFlyerXamarinBinding.AppsFlyerShareInviteHelper.generateInviteUrlWithLinkGenerator ((linkGenerator) => {
linkGenerator.setChannel ("channel_name");
linkGenerator.setReferrerName ("ref_name");
return linkGenerator;
}, completionHandler: (NSURL) => {
Console.WriteLine (NSURL);
}
);
DMA consent
As part of the EU Digital Marketing Act (DMA) legislation, big tech companies must get consent from European end users before using personal data from third-party services for advertising.<br> More information here
The SDK offers two alternative methods for gathering consent data:<br>
- Through a Consent Management Platform (CMP): If the app uses a CMP that complies with the Transparency and Consent Framework (TCF) v2.2 protocol, the SDK can automatically retrieve the consent details.
OR
- Through a dedicated SDK API: Developers can pass Google's required consent data directly to the SDK using a specific API designed for this purpose.
Use CMP to collect consent data
- Call
AppsFlyerLib.Shared.EnableTCFDataCollection(true);
before calling start()
AppsFlyerLib.Shared.EnableTCFDataCollection(true);
- call start() only after the user approve the cmp consent pop up
Full example:
[Export("application:didFinishLaunchingWithOptions:")]
public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
AppsFlyerLib.Shared.AppleAppID = "xXxXxX";
AppsFlyerLib.Shared.AppsFlyerDevKey = "xXxXxX";
AppsFlyerLib.Shared.EnableTCFDataCollection(true);
return true;
}
[Export("applicationDidBecomeActive:")]
public void OnActivated(UIApplication application)
{
if (cmpManager.hasConsent()){
AppsFlyerLib.Shared.Start();
}
}
Note: cmpManager
is here just for the example. use your own CMP.
Manually collect consent data
If your app does not use a CMP compatible with TCF v2.2, use the SDK API detailed below to provide the consent data directly to the SDK.
When GDPR applies to the user
- Given that GDPR is applicable to the user, determine whether the consent data is already stored for this session.
- If there is no consent data stored, show the consent dialog to capture the user consent decision.
- If there is consent data stored continue to the next step.
- To transfer the consent data to the SDK create an AppsFlyerConsent object using forGDPRUser method that accepts the following parameters:
hasConsentForDataUsage
: boolean - Indicates whether the user has consented to use their data for advertising purposes.hasConsentForAdsPersonalization: boolean
- Indicates whether the user has consented to use their data for personalized advertising.
- Call
AppsFlyerLib.Shared.SetConsentData(consent);
with the AppsFlyerConsent object. - Call
AppsFlyerLib.Shared.Start();
Full example:
[Export("application:didFinishLaunchingWithOptions:")]
public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
AppsFlyerLib.Shared.AppleAppID = "xXxXxX";
AppsFlyerLib.Shared.AppsFlyerDevKey = "xXxXxX";
AppsFlyerConsent consent = new AppsFlyerConsent().initForGDPRUser(true, true);
AppsFlyerLib.Shared.SetConsentData(consent);
return true;
}
[Export("applicationDidBecomeActive:")]
public void OnActivated(UIApplication application)
{
AppsFlyerLib.Shared.Start();
}
When GDPR does not apply to the user
- Create an AppsFlyerConsent object using forNonGDPRUser method that doesn't accepts any parameters
- Call
AppsFlyerLib.Shared.SetConsentData(consent);
with the AppsFlyerConsent object. - Call
AppsFlyerLib.Shared.Start();
Full example:
[Export("application:didFinishLaunchingWithOptions:")]
public bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
AppsFlyerLib.Shared.AppleAppID = "xXxXxX";
AppsFlyerLib.Shared.AppsFlyerDevKey = "xXxXxX";
AppsFlyerConsent consent = new AppsFlyerConsent().initNonGDPRUser();
AppsFlyerLib.Shared.SetConsentData(consent);
return true;
}
[Export("applicationDidBecomeActive:")]
public void OnActivated(UIApplication application)
{
AppsFlyerLib.Shared.Start();
}
Sample App
Sample apps for xamarin.ios10
and net6.0-ios
can be found here:
XamariniOSBinding/samples
In order for us to provide optimal support, we would kindly ask you to submit any issues to support@appsflyer.com.
When submitting an issue please specify your AppsFlyer sign-up (account) email, your app ID, production steps, logs, code snippets and any additional relevant information.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0-ios16.1 is compatible. net7.0-ios was computed. net8.0-ios was computed. |
Xamarin.iOS | xamarinios10 is compatible. |
-
net6.0-ios16.1
-
Xamarin.iOS 1.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AppsFlyerXamarinBinding:
Package | Downloads |
---|---|
Oscore.AppsFlyer.Maui
Professional integration of existing Xamarin binding libraries in a single cross-platform interface according to best practices. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
6.13.1 | 5,471 | 3/14/2024 |
6.12.1 | 16,058 | 9/5/2023 |
6.10.1 | 16,542 | 4/11/2023 |
6.9.3-beta1 | 1,206 | 2/9/2023 |
6.9.2 | 3,029 | 2/9/2023 |
6.9.2-beta1 | 1,112 | 2/9/2023 |
6.5.4 | 28,800 | 4/28/2022 |
6.4.0.3 | 28,446 | 10/24/2021 |
6.4.0.1 | 2,881 | 9/29/2021 |
6.3.2 | 55,800 | 6/29/2021 |
6.3.0 | 7,550 | 5/27/2021 |
6.2.6.1 | 16,186 | 4/29/2021 |
6.2.4.1 | 5,784 | 3/31/2021 |
6.2.4 | 4,898 | 3/21/2021 |
6.2.3 | 1,377 | 3/9/2021 |
6.2.1 | 4,633 | 2/16/2021 |
6.1.3.2 | 4,606 | 1/18/2021 |
6.1.3.1 | 899 | 1/14/2021 |
6.1.3 | 841 | 1/14/2021 |
6.1.1 | 7,366 | 11/22/2020 |
6.0.3 | 17,449 | 9/7/2020 |
6.0.2 | 955 | 9/3/2020 |
6.0.1.1-beta | 729 | 8/25/2020 |
5.4.1 | 7,192 | 7/28/2020 |
5.2.0 | 10,240 | 5/7/2020 |
1.3.5 | 26,487 | 9/16/2019 |
1.3.4 | 30,184 | 5/24/2018 |
1.3.3 | 9,311 | 12/18/2017 |
1.3.2 | 8,375 | 7/26/2017 |
1.3.1 | 4,774 | 2/27/2017 |
1.3.0 | 2,579 | 12/7/2016 |