Adding the MobileFirst Foundation SDK to Xamarin Applications
improve this page | report issueOverview
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: ./run.sh
.
Creating an application
Create a Xamarin solution using Xamarin Studio or Visual Studio or use an existing one.
Adding the SDK
- The MobileFirst Native SDK is provided via Nuget Gallery/Repository .
- 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. Right click on the Packages directory, select Add packages and in the search option, search for IBM MobileFirst Platform. Choose IBM.MobileFirstPlatformFoundation and IBM.MobileFirstPlatformFoundationPush .
- Click Add packages. This action installs the Mobile Foundation Native SDK and its dependencies.
Registering the application
- Load the MobileFirst Operations Console.
- Click the New button next to Applications to register a new application and follow the on-screen instructions.
- 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
andInfo.plist
respectively. - After the application is registered, navigate to the application’s Configuration Files tab and copy or download the
mfpclient.plist
andmfpclient.properties
file. Follow the onscreen instructions to add the file to your project.
Completing the setup process
mfpclient.plist
- 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. - Right-click the
mfpclient.plist
file and select Build action.Choose Content.
mfpclient.properties
- Right-click the Assets folder of Xamarin Android project and select Add files... Browse and find the
mfpclient.properties
to the folder. Choose Copy file to project if prompted. - Right-click the
mfpclient.properties
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:
CommonProject:
using Worklight;
iOS:
using MobileFirst.Xamarin.iOS;
Android:
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 Nuget Gallery.
Generated MobileFirst Native SDK artifacts
mfpclient.plist
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. | 192.168.1.63 |
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:
- Review the Adapters development tutorials
- Review the Authentication and security tutorials
- Review the Notifications tutorials
- Review All Tutorials
Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.