Insert can be used in conjunction with a Xamarin Android app. To do so, please consult the integration instructions below.
The Insert SDK is provided as an Android aar package by default. To use Xamarin, contact Insert customer support (email@example.com) and request the Insert SDK for Xamarin. The SDK comes as a DLL together with additional DLLs that are used as dependencies.
Following the below instructions you will need code segments from Insert. You will find these within Insert Android installation instructions. Go to the Insert Console. Click on Apps. Click on your app (or create a new one), then click on SDK Integration.
- Open the 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 and all its dependencies. You can add them all together.
- Open the Android manifest file (under the properties folder). At the bottom switch to the "Source" tab. Copy the Insert activity from the insert console instructions into the Android manifest file in your Xamarin project.
- Open the main Android activity (e.g. MainActivity.cs) and add an Application class. Inside the class add the InitSDK line (Replace $API Key$ 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, JniHandleOwnership transfer)
: base(javaReference, transfer)
public override void OnCreate()
Insert.IO.Insert.InitSDK(Application, $API Key$, $Company$, null);
Calling other Insert APIs
Below are examples of Insert APIs using C#
|Set User Id||Insert.IO.Insert.UserId = "John Smith";|
|Set User Attribute||
Dictionary<string, string> userAttributes = new Dictionary<string, string>();
String eventName = "event1";