Join Chris Griffith for an in-depth discussion in this video Using PhoneGap Build to compile your app, part of Building Mobile Apps with the PhoneGap Command-Line Interface.
- Another difference between the PhoneGap CLI and the Cordova CLI is that the PhoneGap CLI has the ability to use PhoneGap Build to compile your application. If you're unfamiliar with PhoneGap Build, it's an Adobe hosted service that allows you to compile your PhoneGap applications in the cloud. Meaning you do not need to install or maintain local copies of each platform's SDKs in order to create your application. The PhoneGap CLI will zip the www directory and upload it to the PhoneGap Build servers.
Then tell the system to compile it. If you're going to use the PhoneGap Build system, you do not need to use the PhoneGap Build and the specific platform command. Simply create your app using the create command. Then all your development will be within the www directory. The platforms, merges and hooks are not used when building remotely. Before you can use PhoneGap, we do need to sign into the service. There's both a free account, allowing for one app at a time, or a paid account option.
If you're a Creative Cloud subscriber, it is included as part of your subscription. The command to sign in is phonegap remote login -u and then your Adobe ID followed by -p and the associated password. A successful sign-in does not report anything to the command line. Now we can perform our build using the PhoneGap Build system.
The command to do this is phonegap remote build and then the platform we wish to build for. In this case we're going to build for Android. Our app is now being zipped up and sent to the PhoneGap servers and being compiled. Once the app is ready, we can download it from the PhoneGap Build site and install it onto our device. And there, the Android build is now complete. Let's flip over to the Build.PhoneGap site and take a look. I've already logged in to the system and you can see the very top app here is the demo app that we've been compiling.
We can see it has been built actually for a variety of platforms. The iOS version is red because we haven't uploaded our signing certificates and associated it with this application. In a real system you would have to upload your various certificates and provisioning profiles in order to compile for iOS. The nice thing is, using the PhoneGap Build system, you can actually build iOS applications from a Windows machine. It takes a little bit to generate the certificates and provisions, but it's doable. There we have used the PhoneGap CLI to create our app using just the PhoneGap Build solution.
Remember, this is only available in the PhoneGap CLI and not the Cordova CLI.
- Installing the PhoneGap and Cordova CLIs
- Creating a new project
- Building an app
- Testing apps
- Adding and removing plugins
- Using hooks
- Compiling apps remotely