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 binding 4.2.0 of native SDK.
  • Android 4.2.0 of native SDK.

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 Application extension:

EMMA.Instance.StartSession(this);

You have to add the following code in AndroidManfiest.xml:

<meta-data 
     android:name="io.emma.SESSION_KEY" 
     android:value="@string/emma_session_key" />

in iOS in AppDelegate.cs:

EMMA.StartSession("<EMMA Session 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 in order:

  1. Xamarin.GooglePlayServices.Gcm
  2. Naxam.SquareUp.Okhttp3.LoggingInterceptor
  3. Naxam.Retrofit2.Droid
  4. Naxam.Retrofit2.ConvertGson.Droid

Once the packages are added, the list has to be this:

Captura_de_pantalla_2017-11-07_a_las_23.00.30.png

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 

6. Sample App

For viewing the sample app go to this GitHub repository:  

https://github.com/EMMADevelopment/EMMAXamarinSample

Have more questions? Submit a request

0 Comments

Article is closed for comments.