+

Search Tips | Advanced Search

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


Create a new Cordova app with the MobileFirst template

We can use a template to easily create a simple Cordova app that is enabled for IBM MobileFirstâ„¢ Platform Foundation. We can use this app as a starting point to build your own.


Before you begin

The template creates a simple mobile app that displays the text Hello World. To create your Cordova application with the template, you add the template when you initially create your Cordova app with your Cordova development tools.

The template automatically adds the following plug-ins to our app: cordova-plugin-mfp, cordova-plugin-whitelist and cordova-plugin-splashscreen. The cordova-plugin-mfp plug-in is required for a MobileFirst Cordova app. Most applications will need the cordova-plugin-whitelist and cordova-plugin-splashscreen plug-ins. If your app will not need these, we can remove them after the app is initially created. The following steps show how to create your app with the template by using the Apache Cordova CLI:


Procedure

Enter the following command in your command window, where AppName is the name of the new app:


Results

In the www directory of your of your app, (AppName/www), the index.html file contains a simple app that displays Hello World.


What to do next

Add platforms, additional MobileFirst plug-ins, and optionally, other plug-ins to our app. For more information, see Create a new Cordova app without the MobileFirst template. If your app does not need the cordova-plugin-whitelist or cordova-plugin-splashscreen plug-ins, we can remove them.

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