Support Home > SDK Integration > Xamarin – SDK Integration

Xamarin – SDK Integration

The Kochava Xamarin SDK is a lightweight plugin which can be easily integrated into your Android or iOS project. The entire integration process takes less than five minutes and simply requires adding the SDK within your project and then starting the Kochava Tracker in code. If you have already integrated the SDK and started the tracker, please visit Using the SDK and choose a topic.

Our Xamarin SDK supports all Mono frameworks including MonoGame.
Please use our Windows SDK directly if targeting a windows platform.

 

IMPORTANT NOTE: App Tracking Transparency (ATT) implementation is required for Free App Analytics. ONLY devices that have opted-in and have IDFA available will be measured and available in primary reporting and analytics.


Integrating the SDK

Requirements:

  • Android API 16
  • iOS Target 12.4
  • Xcode 14.1

 

Supported Platforms:

  • Android
  • iOS

Integration:

5 Minutes
Estimated Time to Complete
5 Minutes

(Release Notes)

 

Add the SDK —

In order to use the Kochava SDK, first add it within your project. This can be accomplished using NuGet (recommended) or by downloading the DLLs manually and adding them to your project.

    1. Install the latest version of KochavaTrackerXamarin via NuGet.
    2. KochavaTrackerXamarin should now appear within your project’s references.
    3. NOTE: The NuGet will need to be installed in both the Android and iOS modules of your project.

  • After downloading the DLLs for both Android and iOS from the download badge above you can import them into your project as follows where you import the iOS DLL in your iOS project and the Android DLL in your Android project.

    1. Right click the References folder in your project and click Edit References.
    2. Select the .Net Assembly tab and click Browse.
    3. Locate and select the KochavaXamarin DLL and import it.

 

Google Play Store:

If you wish for the SDK to collect the Google Play Ads Identifier (ADID), App Set ID (ASID) and/or make use of the Install Referrer, you must integrate Google Play Services by adding the appropriate dependencies. Collection is handled by the Kochava SDK with only the dependency itself needing to be included. The Kochava SDK does not require specific versions of its dependencies however we recommend keeping them up to date whenever possible.

 

Maven Repository —

google()

 

Dependencies —

Ads Identifier

implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'

NOTE: If using a version prior to version 17.1.0 you must also add the following permission.

<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

 

Install Referrer

implementation 'com.android.installreferrer:installreferrer:2.2'

 

App Set ID

implementation 'com.google.android.gms:play-services-appset:16.0.2'

Huawei App Gallery:

If you wish for the SDK to collect the Huawei Advertising ID (OAID) and/or make use of the Install Referrer, you must integrate the Huawei Ads SDK by adding the appropriate dependencies. Collection is handled by the Kochava SDK with only the dependency itself needing to be included. The Kochava SDK does not require specific versions of its dependencies however we recommend keeping them up to date whenever possible.

 

Maven Repository —

maven { url 'https://developer.huawei.com/repo/' }

 

Dependencies —

Ads Identifier

implementation 'com.huawei.hms:ads-identifier:3.4.39.302'

 

Install Referrer

implementation 'com.huawei.hms:ads-installreferrer:3.4.39.302'

Samsung Galaxy Store:

If you wish for the SDK to collect and/or make use of the Samsung Install Referrer, you must integrate Samsung Install Referrer by adding the appropriate dependencies. Collection is handled by the Kochava SDK with only the dependency itself needing to be included. The Kochava SDK does not require specific versions of its dependencies however we recommend keeping them up to date whenever possible.

 

Install Referrer

implementation 'store.galaxy.samsung.installreferrer:samsung_galaxystore_install_referrer:4.0.0'

Samsung Cloud Gaming:

If you wish for the SDK to collect and/or make use of the local user’s ADID (CGID) when running in the cloud gaming environment, you must integrate the Samsung Cloud Dev SDK by adding the appropriate dependencies and permissions. Collection is handled by the Kochava SDK with only the dependency itself needing to be included. The Kochava SDK does not require specific versions of its dependencies however we recommend keeping them up to date whenever possible.

 

Dependencies —

Add the couddevsdk.aar file to your project, this can be obtained by contacting your Samsung representative directly.

 

Permissions —

<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

Network Data Gathering:

The following permissions are optional and used by the Network Datapoint module of the Kochava SDK. They are automatically included if using that module but can be removed if desired.

// Wifi State Collection.
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

// Remove the automatically included Wifi State permission.
<!-- <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" tools:node="remove"/> -->

// Network State Collection.
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

// Remove the automatically included Network State permission.
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" tools:node="remove"/> -->


Starting the Tracker

1 Minute
Estimated Time to Complete
1 Minute

Once you have added the Kochava SDK to your project, the next step is to configure and start the Kochava Tracker in code. Only your App GUID is required to start the tracker with the default settings, which is the case for typical integrations.

We recommend starting the tracker as soon as the application starts. This would be in Application.onCreate for Android and in UIApplicationDelegate.FinishedLaunching for iOS, although this can be done elsewhere if needed. Starting the tracker as early as possible will provide more accurate session reporting and help to ensure the tracker has been started before using it. Keep in mind the tracker can only be configured and started once per launch.

Kochava.Tracker.Configuration config = new Kochava.Tracker.Configuration();
config.AndroidAppGuid = "_YOUR_ANDROID_APP_GUID_";
config.IosAppGuid = "_YOUR_IOS_APP_GUID_";
Kochava.Tracker.Client.Configure(config);

Confirm the Integration

After integrating the SDK and adding the code to start the measurement client, launch and run the app for at least 10 seconds or more. During this time the client will start and send an install payload to Kochava. To confirm integration was successful, visit the app’s Install Feed Validation page Apps & Assets > Install Feed Validation. On this page you should see one of two integration messages, indicating integration success or failure.

 

Integration Successful:

 Integration Success!

 

Along with this message you will also see a variety of data points associated with the device used for testing. At this point your integration is successful and you can proceed to the next step(s).

NOTE: It may take a few minutes for the first install to appear within the Install Feed Validation page. If you do not see this message immediately, you may simply need to wait a few minutes and check again.


Integration Not Complete:

 Integration Not Complete!

 

If you encounter this message, please review the integration steps, uninstall and reinstall the app, and check again.

 

SDK WAYPOINT: At this point basic integration is complete and the Kochava SDK will begin reporting session activity and attributing installs.

 

Where to Go From Here:

Now that you have completed integration you are ready to utilize the many features offered by the Kochava SDK. Continue on to Using the SDK and choose a topic.

 
 

Last Modified: Dec 5, 2023 at 1:40 pm