Android and iOS integration

EMMA has two SDK for Xamarin, one for Android and one for iOS. Both are "bindings" of the respective native libraries, therefore methods share name and how to integrate it is very similar to the native.

1. Download the SDK

  • iOS version 2.0
  • Android versión 2.0

Download from Github 

2. Add the .dll to the project

First, you have to import the EMMA SDK our Xamarin project. You have to add in the References folder, in this folder system libraries or third-party libraries are housed.

To add the SDK as a reference, copy the .dll file to the root folder of the project, then add the reference, giving right-click on the folder:

Once open the Edit Reference screen, access to the .Net Assembly tab:

Choose the .dll file:

Once you have selected .dll, go to the All tab to add the library to the project.

Click OK and you have the SDK integrated into the project.

The Android procedure is the same.

3. Start session

In both OS to start session, you must specify the use of the library in the code:

using eMMaSDK; 

In Android add it to MainActivity.cs, in iOS in AppDelegate.cs. For start session:

eMMa.StarteMMaSession("<eMMa_key>");

NOTE: If you are using iOS XamarinForms, add the following attribute in the AppDelegate.cs:

public override UIWindow Window {
      get;
      set;
}

4. Dependencies

To integrate the SDK in Android, add the following packages

  • Xamarin.Android.Support.v4
  • Xamarin.GooglePlayServices.Base
  • Xamarin.GooglePlayServices.Gcm
  • Xamarin.GooglePlayServices.Basement
  • Xamarin.GooglePlayServices.Measurement

In versión 2.0 it's necessary to add the following packages in this order:

  1. Naxam - Square OkHttp3 Logging Interceptor.
  2. Naxam - Square Retrofit2 ConverterGson.

This is the result:

Captura_de_pantalla_2017-05-19_a_las_10.43.17.png

Once these packages are added redundant references have to be eliminated, for this the following steps must be followed: 

  1. Delete the redundant OKHttp3 packet reference.
    Captura_de_pantalla_2017-05-19_a_las_10.57.07.png
  2. Once this reference is removed we clean the project and compile again.

5. Continue with integration

Once the above points, and you can use all the options offered by the SDK EMMA, you must consult the documentation of native libraries. The method names are identical, only changes the manner of invocation with C#.

integration documentation 

Have more questions? Submit a request

0 Comments

Article is closed for comments.