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:
- 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. - 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.
- 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
. - On your Mac computer double click the file to extract the contents.
- Launch the Terminal app and change the directory to the path where the BuildTool.zip is extracted as per the above step.
- Run the following command in Terminal app to install required NPM module:
- Add needed platform using
cordova platform add ios
. - Build iOS app using
cordova build ios
. - Add the required Cordova plugin using
cordova plugin add <plugin_name>
. - Create a
javascript
file to include required functionality from imported plugin. You must export all the functions via a single variable. Yourjavascript
file looks similar to the example shown in the image below: - Add the
javascript
file as external script in your UI model. You can use all the available features fromjavascript
file. For example, as shown in the above image invokingcontacts.search
allows to call thesearch 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)/);
- Test your application for the native features using ASG-Studio mobile app and fix the issues if you find any.
$ npm install xml2js