Chapter 3. Creating Cordova projects

 

This chapter covers

  • Creating Cordova projects from the CLI
  • Adding platform support
  • Working with Android emulators and devices
  • Sending your project to an emulator or device

Now that you’ve got your local environment running, it’s time to look closer at what makes up a Cordova project. At the end of chapter 2, you created a project just for testing purposes; let’s cover how projects are created with a bit more detail, and then examine what’s created in the filesystem. We’ll also walk through setting up an Android emulator and detail how to send an application to it or a real device. Finally, you’ll build a real (although rather simple) application.

Let’s start by looking at the typical process flow of working with Cordova. Figure 3.1 demonstrates the steps you’ll follow when working on a Cordova project.

Figure 3.1. Typical Cordova process

You begin by creating a project and then telling it which platforms you’ll be supporting. At that point you begin editing your web files (HTML, JavaScript, CSS) and sending them to an emulator (or a device) so you can see how they look (along with testing functionality, of course). In the next chapter we’ll slightly enhance this, but for now this gives you a high-level look at what the typical Cordova project process is like. Now let’s dig deeper.

3.1. Creating projects with the Cordova CLI

In chapter 2 you used the following command to create a project:

cordova create myfirstproject

3.2. Digging into a Cordova project

3.3. Adding platforms

3.4. Working with Android emulators and devices

3.5. Sending your Cordova application to the emulator (or device)

3.6. Building your first real application

3.7. Summary