Adding the MobileFirst Foundation SDK to Xamarin Applications

improve this page | report issue


The Mobile Foundation SDK consists of a collection of dependencies that are available through Xamarin Component store and which you can add to your Xamarin project.
The pods correspond to core functions and other functions:

  • MobileFirst.Xamarin - Implements client-to-server connectivity, handles authentication and security aspects, resource requests, and other required core functions.
  • MobileFirst.JSONStore - Contains the JSONStore framework.
  • MobileFirst.Push - Contains the push notification framework. For more information, review the Notifications tutorials.

In this tutorial you learn how to add the MobileFirst Native SDK by using Xamarin Component Store to a new or existing Xamarin Android or iOS application. You also learn how to configure the MobileFirst Server to recognize the application.


Jump to:

Adding the MobileFirst Native SDK

Follow the instructions below to add the MobileFirst Native SDK to a new or existing Xcode project, and to register the application to the MobileFirst Server.

Before you start, make sure that the MobileFirst Server is running.
If using a locally installed server: From a Command-line window, navigate to the server’s folder and run the command: ./

Creating an application

Create a Xamarin solution using Xamarin Studio or Visual Studio or use an existing one.

Adding the SDK

  1. The MobileFirst Native SDK is provided via Xamarin Components Store.
  2. Expand the Android or iOS project.
  3. In the Android or iOS project, right-click Components.
  4. Select Get More Components. Add-XamarinSDK-tosolution-search
  5. Search for IBM MobileFirst SDK. Choose and do Add to App. Add-XamarinSDK-tosolution
  6. Right-click Packages and select Add packages .Search for and add Json.NET. This pulls in the Newtonsoft dependency from Nuget. This needs to be done separately for both Android and iOS projects.
  7. Right-click References and select Edit References. Go to .Net Assembly tab and click ‘Browse’. From the project folder’s root go to Components -> ibm-worklight- -> lib -> pcl. Select Worklight.Core.dll.

Registering the application

  1. Load the MobileFirst Operations Console.
  2. Click the New button next to Applications to register a new application and follow the on-screen instructions.
  3. Android and iOS applications have to be registered separately. This ensures both the Android application and iOS application can connect successfully to the server. The registration details for Android and iOS applications can be found in the AndroidManifest.xml and Info.plist respectively.
  4. After the application is registered, navigate to the application’s Configuration Files tab and copy or download the mfpclient.plist and file. Follow the onscreen instructions to add the file to your project.

Completing the setup process


  1. Right-click the Xamarin iOS project and select Add files... Browse and find the mfpclient.plist to the root of the project. Choose Copy file to project if prompted.
  2. Right-click the mfpclient.plist file and select Build action.Choose Content.

  1. Right-click the Assets folder of Xamarin Android project and select Add files... Browse and find the to the folder. Choose Copy file to project if prompted.
  2. Right-click the file and select Build action.Choose Android asset.

Referencing the SDK

Whenever you want to use the MobileFirst Native SDK, make sure that you import the Mobile Foundation framework:


using Worklight;


using MobileFirst.Xamarin.iOS;


using Worklight.Xamarin.Android;

Updating the MobileFirst Native SDK

To update the MobileFirst Native SDK with the latest release, update the version of the SDK via the Xamarin Components store.

Generated MobileFirst Native SDK artifacts


This file defines the client-side properties used for registering your iOS app on the MobileFirst Server.

Property Description Example values
protocol The communication protocol with the MobileFirst Server. http or https
host The host name of the MobileFirst Server.
port The port of the MobileFirst Server. 9080
wlServerContext The context root path of the application on the MobileFirst Server. /mfp/
languagePreferences Sets the default language for client sdk system messages. en

Tutorials to follow next

With the MobileFirst Native SDK now integrated, you can now:

Last modified on January 30, 2017