Setting up a Cordova project
Complete the instructions to set up a Cordova project.
Procedure
- Create a workspace folder as follows.
cd <cordova_project_container_folder>
- Create a Cordova project by running the following command: For example,
cordova create StoreAppDemo com.ibm.isf.StoreAppDemo StoreAppDemo
cordova create <project_name> <package_name> <folder_name>
For example,cordova create StoreAppDemo com.ibm.isf.StoreAppDemo StoreAppDemo
- Install iOS and Android SDK platforms and run the appropriate commands.
- For iOS, run the following
command:
cordova platform add ios
- For Android, run the following
command:
cordova platform add android
- For iOS, run the following
command:
- Install Cordova plug-ins by running the appropriate commands.
- Install the Cordova plug-in device by running the following
command:
cordova plugin add cordova-plugin-device
- Install the Cordova plug-in console by running the following
command:
cordova plugin add cordova-plugin-console
- Install peripheral device plug-ins.
- If necessary, install the base plug-ins. For more information, see Cordova Plugins.
- Install the Cordova plug-in device by running the following
command:
- Modify the Cordova config.xml file that is present in
<project_folder>
.- Set the value of
src
attribute in the content element to point to the application URL.For example,<content src="http://localhost:9080/isf/store/store-frontend/index.html"/>
- Update the following elements to allow the application to access the URLs:
<allow-navigation href="http://*/*" /> <allow-navigation href="https://*/*" /> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" />
- Set an appropriate value for the
AppendUserAgent
attribute to load platform-specific Cordova plug-ins as follows.<preference name="AppendUserAgent" value="< >" />
. For example,<preference name="AppendUserAgent" value="cordova-ios" />
. - Configure the project settings if specified by the plug-ins provided by peripheral-device vendors.
- Complete any additional instructions that are provided by the plug-ins that you installed.
- Set the value of
- Build and deploy the application on the appropriate device. For more information, see the following resources: