Build your application to install to a device or simulator for testing or for publishing to app stores. You can build applications locally using the PhoneGap Command Line Interface, or in the cloud using PhoneGap Build.
A complete step-by-step article on how to build a mobile application using code available from GitHub is available here.
Move application files to the publish instance so that you can provide content updates to the installed instances of the mobile application, and to build the application using the published content. Applications consist of two node branches in the repository:
- /content/phonegap/apps/<application name>: The web pages that authors create and activate.
- /content/phonegap/content/<application name>: Application configuration files and Content Sync configurations.
If you do not move the application files to the publish instance, content authors cannot update the Content Sync cache.
You only need to move the files in the /content/phonegap/content/<application name> branch to the publish instance. The files in the /content/phonegap/apps/<application name> branch are moved when the author activates the pages.
AEM provides two methods for moving bulk content to the publish instance:
For example, a mobile application named phonegapapp is created. The following node must be moved to the publish instance: /content/phonegap/content/phonegapapp.
Tip: To move a package from the author instance to the publish instance, use the Replicate command on the package.
Compile the PhoneGap application on your computer using the PhoneGap Command-line Interface (CLI). To include the AEM content into your application, AEM creates a ZIP file that contains the content of your mobile application, Content Sync configurations, and other required assets. Download the ZIP file and include it in your build.
To build using the PhoneGap CLI, you need to install Node.js and the PhoneGap client utility. You require an internet connection to perform the following procedure.
Open a terminal or command prompt and enter the following node command to install the PhoneGap utility:
npm install -g phonegap
On a Unix or Linux system, you may need to prefix the command with sudo.
The terminal shows the results of a series of HTTP GET commands. When the installation is succesful, the terminal shows where the libraries are installed similar to the following example:
/usr/local/bin/phonegap -> /usr/local/lib/node_modules/phonegap/bin/phonegap.js email@example.com /usr/local/lib/node_modules/phonegap ├── firstname.lastname@example.org ├── email@example.com ├── firstname.lastname@example.org ├── email@example.com ├── firstname.lastname@example.org ├── email@example.com (...) ├── firstname.lastname@example.org (...) ├── email@example.com (...) ├── firstname.lastname@example.org (...) └── email@example.com (...)
Use the PhoneGap CLI to compile and install the application. For information about how to use the PhoneGap CLI, see the PhoneGap Command-line Interface documentation.
Use the PhoneGap cloud service to build your app. To perform this procedure, you must first create a PhoneGap Build configuration.
Create a PhoneGap Build configuration so that you can use the PhoneGap Build services from within AEM. Provide the user name and password of the PhoneGap Build account that you will use to build your mobile applications.
For information about installing the build, see the PhoneGap Build Documentation.
Free PhoneGap Build accounts are allowed one private application. PhoneGap builds fail if you are building an additional private application.