+

Search Tips | Advanced Search

For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.


Add MobileFirst features to an existing Cordova app

We can add capabilities provided by IBM MobileFirstâ„¢ Platform Foundation to an existing Cordova app created with Apache Cordova, Ionic, or other third-party tools by adding the IBM MobileFirst Platform Foundation SDK to our app. The SDK is provided in the form of Cordova plug-ins.


Before you begin

We can add any of the following plug-ins to our app.

The cordova-plugin-mfp provides the MobileFirst SDK and is required. See Cordova plug-ins for MobileFirst features for information about the function of each of the other plug-ins.


Procedure

  1. To review the readme file for the plug-ins that we want, navigate to the download page for each one on the npm web site in your web browser. Use one or more of the following URLs, depending on the plug-in:

    Note: We can also download the compressed (.zip) file packages from JazzHub. Click the link that starts with hub.jazz.net from the npm page for a given plug-in to reach the download page.

  2. On your local system, navigate to the root folder of your Cordova app.
  3. Run one of the following commands, depending on which plug-ins we want to install.

    Note: The following steps use the Cordova CLI. If you are using different Cordova-compatible tools, the procedure might differ.

    Important: Check your app's components for compatibility issues, to make sure that they will work with the latest plug-ins. The latest available versions of plug-ins will be downloaded by default with the commands described in this step. To download a specific version of a plug-in, specify the version number by using the syntax cordova plugin add plugin_name@version. For example, to download the latest published plug-in for IBM MobileFirst Platform Foundation 8.0, use cordova plugin add cordova-plugin-mfp@8.0. If we want to import a specific version such as 8.0.2016021411, replace with the version number you are using, including the major minor and patch numbers. The patch number is in the format YYYYMMDDHH.. For example: cordova plugin add cordova-plugin-mfp@8.0.2016021411.

    IBM MobileFirst Platform Foundation

    • To install the core MobileFirst Cordova plug-in:

        cordova plugin add cordova-plugin-mfp

      Or if you acquired the Cordova SDK from MobileFirst Operations Console

        cordova plugin add <unzip_dir>/plugins/cordova-plugin-mfp

      Where <unzip_dir> is the directory where you unzipped the acquired SDK.

    • To install the cordova-plugin-mfp-push and cordova-plugin-mfp plug-ins:

        cordova plugin add cordova-plugin-mfp-push

    • To install the cordova-plugin-mfp-jsonstore and cordova-plugin-mfp plug-ins:

        cordova plugin add cordova-plugin-mfp-jsonstore

    • To install the cordova-plugin-mfp-fips and cordova-plugin-mfp plug-ins:

        cordova plugin add cordova-plugin-mfp-fips

    • To install the cordova-plugin-mfp-encrypt-utils and cordova-plugin-mfp plug-ins:

        cordova plugin add cordova-plugin-mfp-encrypt-utils

    Note: If you install cordova-plugin-mfp by itself, we can add the cordova-plugin-mfp-push , cordova-plugin-mfp-jsonstore , cordova-plugin-mfp-fips or cordova-plugin-mfp-encrypt-utils plug-ins later by specifying them with the cordova plugin add command.


Results

The IBM MobileFirst Platform Foundation SDK plug-ins for Cordova are installed.


What to do next

We can now start developing the IBM MobileFirst Platform Foundation capabilities in your Cordova app.

To further develop your app with features that depend on the MobileFirst Server, register your app with the server. For more information, see Register Cordova applications from the MobileFirst Platform CLI.

Important: (Android and iOS development only.) If you are developing your app for the Android or iOS platforms, when you add the platform to our app that contains the cordova-plugin-mfp plug-in, an existing file in your app is replaced by a version of the file that is provided by MobileFirst Platform Foundation. These files are:

If you made any changes to the original versions of these files, we must merge the changes that you made into the new version of the file that is provided by IBM MobileFirst Platform Foundation.

Parent topic: Create Cordova apps that include MobileFirst features