describes how to run Flexberry Ember apps as mobile apps Apache Cordova.
The application to run as mobile apps Apache Cordova
Applications can be converted to a hybrid mobile application based on the Apache Cordova.
Installation
- Install Ember CLI and Cordova (>= 6.0.0) using NPM.
npm install -g ember-cli
npm install -g cordova
- Create a Cordova project
cordova create hello com.example.hello HelloWorld
- Creation of project Ember (if necessary)
If the project already exists, then, depending on the project requirements, you need to configure the directory in which the build will be the application’s Ember. Its typical file name is
.ember-cli
.
Read more about create a Cordova project, you can read the documentation.
Features application configuration Ember
For correct operation of the application Flexberry Ember inside Cordova may require minor adjustments.
- Routing must be enabled
hash
mode. - Parameter
output-path
(file.ember-cli
or argumentember build
) needs to refer towww
folder in the root of your Cordova app. - The paths to the resources should not be absolute, because he
index.html
in apk is not in the root. - VCS need an empty folder
www
; otherwise it will error “Current working directory is not a Cordova-based project.”
Setup automated build application
In order to build Cordova apps was automatic build of Ember app, you can use the hooks.
To do this:
- Create a NodeJS script to run
ember build
. Example script. - To set the hook in the configuration file of your Cordova project (
config.xml
). Example configuration file.
Security settings
A mobile platform, to increase security of applications, set a number of restrictions on access to the network.
For iOS 9 you need to configure Transport Security in *-info.plist as follows:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
or this:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>yourserver.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify the minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
The demo application
As example, consider a demo application on GitHub.