The following knowledge article is applicable when using Insert Android SDK 44 or higher
- The Insert SDK is provided as an Android aar package by default. To use Xamarin, contact Insert customer support (firstname.lastname@example.org) and request the Insert SDK for Xamarin.
The SDK comes as a DLL and requires additional dependencies which are automatically downloaded from NuGet.
- Your app must be targeted for Android 7. Go to Project | <Project Name> Options. Under the General tab, verify that Target Framework is Android 7.0 (Nougat)
- When following the instructions below, you will need additional code segments from Insert. These can be found within the Insert Console: Go to the Insert Console. Click on Apps. Click on your app (or create a new one), then click on SDK Integration.
- Open Xamarin Studio.
- Add a reference to the Insert dll in your project: On the top menu go to Project | Edit References. In the reference dialog, go to the .Net Assembly tab. Press the Browse button and add the Insert DLL.
- On the top menu, got to Project | Add NuGet Packages. Add all the packages from the list below. Make sure you select the right versions.
Important note: You must check that the packages below do not clash with your existing packages.
Package Version Xamarin.Android.Support.v13 25.3.1 Xamarin.Android.Support.v7.RecyclerView 25.3.1 Xamarin.Android.Support.v7.Palette 22.2.0 Xamarin.Android.Support.v4 25.3.1 Square.Picasso 2.5.2 Square.OkHttp3 3.4.2 Square.OkHttp3.WS 3.4.2 NineOldAndroids 2.4.0 GoogleGson 2.8.0 socket.io.client 0.8.2 engine.io.client 0.8.2
- Open the Android manifest file (under the properties folder). At the bottom switch to the "Source" tab. Copy the Insert activity from the Insert SDK integration instructions (accessed within the Insert Console per the above) into the Android manifest file in your Xamarin project.
- Add an Application class (see code below). Inside the class add the InitSDK line (Replace $APIKey$ and $Company$ with data from the InitSDK call in your app's integration instructions). Use the code below as a sample
public class SampleApp : Application
protected SampleApp(IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer)
: base(javaReference, transfer)
public override void OnCreate()
Insert.IO.Insert.InitSDK(this, $APIKey$, $Company$, null);
Using additional Insert APIs
Below are the additional APIs available provided by the Insert framework
|Set User Id||Insert.IO.Insert.UserId = "John Smith";|
|Set User Attribute||
Dictionary<string, string> userAttributes = new Dictionary<string, string>();
String eventName = "event1";