Quickstart

Last updated last month

Follow these steps to have a basic integration of the app's miles® SDK in your Xamarin application.

Xamarin Quickstart

Work In Progress

Conditions and minimum requirements

Minimum Android version: 4.1 (API 16) Minimum iOS version : 7.0 Minimum XCode version : 7

I. Installation

We publish the Xamarin SDK on Nuget under the name of XAPM

Adding NuGet packages

You need to add NuGet packages in 3 different places:

  • Main project

  • iOS project

  • Android project

Main project
iOS
Android

In main project, add NuGet package :

  • XAPM.Interface

In iOS project, add NuGet packages :

  • XAPM.Interface

  • XAPM.iOS.Impl

  • XAPM.iOS.SDK

In Android project, add NuGet packages :

  • XAPM.Interface

  • XAPM.Droid.Impl

  • XAPM.Droid.SDK

II. Configuration

No additional configuration required

III. Initialization

You will also need to initialize the SDK in 3 different places

Main project
iOS
Android

In main project, in file App.xaml.cs, init the SDK :

  • partnerID : <PARTNER_ID>

  • partnerSecret : <PARTNER_SECRET>

  • appId : <APP_ID>

  • baseUrl : <BASE_URL>

App.xaml.cs
public App()
{
InitializeComponent();
APM.Register();
APM.SetBaseUrl(<BASE_URL>);
APM.InitApp(<PARTNER_ID>, <PARTNER_SECRET>, <APP_ID>);
MainPage = new MainPage();
}

In file MainPage.xaml.cs, call the method APM.RefreshSDK();

MainPage.xaml.cs
public MainPage()
{
InitializeComponent();
APM.RefreshSDK();
}

In iOS project, in file AppDelegate.cs, init iOS SDK :

AppDelegate.cs
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
XAPM.iOS.Impl.Initializer.Init();
return base.FinishedLaunching(app, options);
}

In Android project, in file MainApplication.cs, init Android SDK :

MainApplication.cs
public override void OnCreate()
{
base.OnCreate();
RegisterActivityLifecycleCallbacks(this);
// A great place to initialize Xamarin.Insights and Dependency Services!
XAPM.Droid.Impl.Initializer.Init();
}

You're done with the installation !

You should be able to see our SDK on your application.

And the banner appear !

Head to the next section to start integrating our SDK into your app's features.