Adding the MobileFirst Foundation SDK to Windows 8.1 Universal or Windows 10 UWP Applications
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.
- Microsoft Visual Studio 2013 or 2015 and MobileFirst CLI installed on the developer workstation. Developing Windows 10 UWP solution requires at least Visual Studio 2015.
- A local or remote instance of MobileFirst Server is running.
- Read the Setting up your MobileFirst development environment and Setting up your Windows 8 Universal and Windows 10 UWP development environment tutorials.
- Adding the MobileFirst Native SDK
- Manually Adding the MobileFirst Native SDK
- Updating the MobileFirst Native SDK
- Generated MobileFirst Native SDK artifacts
- Tutorials to follow next
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:
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
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.
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.
In the search option, search for “IBM MobileFirst Platform”. Choose IBM.MobileFirstPlatform.184.108.40.206.
Click Install. This action installs the Mobile Foundation Native SDK and its dependencies. This step also generates an empty
mfpclient.reswfile in the
stringsfolder of the Visual Studio project.
Ensure that, at a minimum, the following capabilities are enabled in
- 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.
- Get the Mobile Foundation SDK from the MobileFirst Operations Console → Download Center → SDKs tab.
- Extract the contents of the downloaded SDK obtained in step 1.
- Open the Windows Universal native project in Visual Studio. Perform the following steps.
- Select Tools → NuGet Package Manager → Package Manager Settings.
- Select Package Sources option. Click + icon to add new package source.
- Provide a name for the package source (for example: windows8nuget)
- Navigate to the MobileFirst SDK folder that was downloaded and extracted. Click OK.
- Click Update and then click OK.
- Right-click the Solution project-name in Solution explorer tab, which is to the right corner of the screen.
- Select Manage NuGet Packages for Solutions → Online → windows8nuget.
- Click Install option. You get the option to Select Projects.
- Ensure that all the check boxes are checked. Click OK.
Registering the application
Open the Command-line and navigate to the root of the Visual Studio project.
Run the command:
mfpdev app register
- If you use a remote server, use the command
mfpdev server addto add it.
- If you use a remote server, use the command
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:
- Load the MobileFirst Operations Console.
- Click the New button next to Applications to register a new application and follow the on-screen instructions.
- 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:
Generated MobileFirst Native SDK artifacts
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
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:
- Review the Using the Mobile Foundation SDK tutorials
- Review the Adapters development tutorials
- Review the Authentication and security tutorials
- Review the Notifications tutorials
- Review All Tutorials