User Guide: SDKs > Cordova (PhoneGap) SDK > Creating a Cordova App
Creating a Cordova App
To create an application and build it using the Cordova command-line interface (CLI), follow these steps:
-
Run the following command in the command prompt:
npm install –g cordova
-
Now run the following command:
Cordova create AndroidPhoneGapApp com.voltmx MyApp
In this command, AndroidPhoneGapApp
is the name of the
project folder, com.voltmx
is the namespace, and
MyApp
is the name of the project or application. The order of parameters is fixed.
Note: If you do not specify com.voltmx and MyApp parameters, by default the namespace will as "com. hello" and creation of the project will require more time.
The default app name is HelloCordova after the app gets installed.
- Run the following command to navigate to the project folder.
cd AndroidPhoneGapApp
- Run the following command to add the Android platform.
cordova platform add android
(You can add other platforms such as iOS and BlackBerry.)
- Run the following command to install the plug-in device - such as UUID. This step is mandatory.
cordova plugin add cordova-plugin-device
- Run the following command to install the plug-in, InAppBrowser. For example, if you use Oauth/SAML provider for authentication, this plug-in is required. This step is mandatory.
cordova plugin add cordova-plugin-inappbrowser
- Run the following command to get the console logs. This step is optional.
cordova plugin add cordova-plugin-console
Note: This plugin has been deprecated. For more information, click here.
-
Copy the
com.voltmx.sdk
fromvoltmx-phonegap-sdk-sdk
, and pastecom.voltmx.sdk
into the app root folder. -
Run the following command to add Volt MX Foundry plug-in into your applications:
cordova plugin add com.voltmx.sdk
-
Add the buttons or required widgets in the
index.html
file, and map them to the required functions by including the respectiveJS Scripts
. Use Script tag, and include the required.js
files. -
Run the following command to deploy your app:
-
on Android platform:
cordova emulate android or cordova run android
- on iOS platform:
cordova build ios
After running this command, the system generates the xcode project under the platform/ios
folder. Open the xcode and run the ios phonegap app.