Adding the MobileFirst Foundation SDK to Windows 8.1 Universal or Windows 10 UWP Applications

improve this page | report issue

Overview

The Mobile Foundation SDK consists of a collection of dependencies that are available through Nuget, and which you can add to your Visual Studio project. The dependencies correspond to core functions and other functions:

  • IBMMobileFirstPlatformFoundation - Implements client-to-server connectivity, handles authentication and security aspects, resource requests, and other required core functions.

In this tutorial, you learn how to add the MobileFirst Native SDK by using Nuget to a new or existing Windows 8.1 Universal application or to a Windows 10 UWP (Universal Windows Platform) application. You also learn how to configure the MobileFirst Server to recognize the application, and to find information about the MobileFirst configuration files that are added to the project.

Prerequisites:

Jump to:

Adding the MobileFirst Native SDK

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

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

Creating an application

Create a Windows 8.1 Universal or Windows 10 UWP project by using Visual Studio 2013/2015 or use an existing project.

Adding the SDK

  1. To import MobileFirst packages, use the NuGet package manager. NuGet is the package manager for the Microsoft development platform, including .NET. The NuGet client tools provide the ability to produce and use packages. The NuGet Gallery is the central package repository used by all package authors and users.

  2. Open the Windows 8.1 Universal or Windows 10 UWP project in Visual studio 2013/2015. Right-click the project solution and select Manage Nuget packages.

    Add-Nuget-tosolution-VS-settings

  3. In the search option, search for “IBM MobileFirst Platform”. Choose IBM.MobileFirstPlatform.8.0.0.0.

    Add-Nuget-tosolution-search

    Add-Nuget-tosolution-choose

  4. Click Install. This action installs the Mobile Foundation Native SDK and its dependencies. This step also generates an empty mfpclient.resw file in the strings folder of the Visual Studio project.

  5. Ensure that, at a minimum, the following capabilities are enabled in Package.appxmanifest:

    • Internet (Client)

Manually adding the MobileFirst Native SDK

You can also manually add the Mobile Foundation SDK:

You can prepare your environment for developing MobileFirst applications by getting the framework and library files manually. The Mobile Foundation SDK for Windows 8 and Windows 10 Universal Windows Platform (UWP) is also available from NuGet.

  1. Get the Mobile Foundation SDK from the MobileFirst Operations Console → Download Center → SDKs tab.
  2. Extract the contents of the downloaded SDK obtained in step 1.
  3. Open the Windows Universal native project in Visual Studio. Perform the following steps.
    1. Select Tools → NuGet Package Manager → Package Manager Settings.
    2. Select Package Sources option. Click + icon to add new package source.
    3. Provide a name for the package source (for example: windows8nuget)
    4. Navigate to the MobileFirst SDK folder that was downloaded and extracted. Click OK.
    5. Click Update and then click OK.
    6. Right-click the Solution project-name in Solution explorer tab, which is to the right corner of the screen.
    7. Select Manage NuGet Packages for Solutions → Online → windows8nuget.
    8. Click Install option. You get the option to Select Projects.
    9. Ensure that all the check boxes are checked. Click OK.

Registering the application

  1. Open the Command-line and navigate to the root of the Visual Studio project.

  2. Run the command:

    mfpdev app register
    

The mfpdev app register CLI command first connects to the MobileFirst Server to register the application, then updates the mfpclient.resw file in the strings folder in the Visual Studio project, and adds to it the metadata that identifies the MobileFirst Server.

Tip: You can also register applications from the MobileFirst Operations Console:

  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. After the application is registered, navigate to the application’s Configuration Files tab and copy or download the mfpclient.resw file. Follow the onscreen instructions to add the file to your project.

Updating the MobileFirst Native SDK

To update the MobileFirst Native SDK with the latest release, run the following command from the root folder of the Visual Studio project in a Command-line window:

Nuget update

Generated MobileFirst Native SDK artifacts

mfpclient.resw

Located in the strings folder of the project, this file contains server connectivity properties and is user-editable:

  • protocol – The communication protocol to MobileFirst Server. Either HTTP or HTTPS.
  • WlAppId - The identifier of the application. This should be same as the application identifier in the server.
  • host – The host name of the MobileFirst Server instance.
  • port – The port of the MobileFirst Server instance.
  • wlServerContext – The context root path of the application on the MobileFirst Server instance.
  • languagePreference - Sets the default language for client sdk system messages.

Tutorials to follow next

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

Last modified on January 25, 2017