Create IPA and Use Cordova Plugins

ASG-Zenith mobile application is a hybrid app based on Cordova cross platform mobile library. Cordova library provides the necessary bridge code for the HTML or Javascript based applications to communicate with the mobile device features. These bridge components are called Cordova Plugins, and are available for different native features in Cordova Open Source project and from third party implementations.

ASG-Zenith platform supports a variety of native device features like camera, file etc. However, there may be use cases for business applications to leverage other features beyond the supported ones. This document explains how to integrate Cordova plugin and use the features provided by the plugin with in ASG-Zenith applications.

ASG-Zenith provides mobile app support for ASG-Studio (design time) and ASG-Zenith Portal (runtime).

Perform the following steps:

  1. Install Carthage that helps to add required frameworks to build iOS mobile applications. The Carthage.pkg installation file is currently available for download at https://github.com/Carthage/Carthage/releases. For documentation and instructions about how to install Carthage, see link.
    We recommend to install the latest version of Carthage. The currently available latest version is Carthage 0.35.0.
  2. Setup the Cordova development environment in your Mac computer by following the steps detailed at https://cordova.apache.org/docs/en/latest/guide/platforms/ios/index.html.
  3. Navigate to ASG-Studio installed location on Windows computer and copy the BuildTool.zip file to your Mac computer. The typical path where the BuildTool.zip file available is C:\Program Files (x86)\ASG STUDIO\mobile\ios.
  4. On your Mac computer double click the file to extract the contents.
  5. Launch the Terminal app and change the directory to the path where the BuildTool.zip is extracted as per the above step.
  6. Run the following command in Terminal app to install required NPM module:
  7. $ npm install xml2js

  8. Add needed platform using cordova platform add ios.
  9. Build iOS app using cordova build ios.
  10. Add the required Cordova plugin using cordova plugin add <plugin_name>.
  11. Create a javascript file to include required functionality from imported plugin. You must export all the functions via a single variable. Your javascript file looks similar to the example shown in the image below:
  12. Add the javascript file as external script in your UI model. You can use all the available features from javascript file. For example, as shown in the above image invoking contacts.search allows to call the search function.
    As these features work only on mobile devices, it is recommended to check the device using:
    • navigator.userAgent.toLowerCase().match(/\(ip.*applewebkit(?!.*(version|crios))/);
    • navigator.userAgent.toLowerCase().match(/android.*applewebkit(?=.*version)/);
  13. Test your application for the native features using ASG-Studio mobile app and fix the issues if you find any.