Book Image

PhoneGap 3.x Mobile Application Development HOTSHOT

By : Kerri Shotts
Book Image

PhoneGap 3.x Mobile Application Development HOTSHOT

By: Kerri Shotts

Overview of this book

<p>PhoneGap allows you to use your existing knowledge of HTML, CSS, and JavaScript to create useful and exciting mobile applications.<br /><br />This book will present you with 12 exciting projects that will introduce you to the dynamic world of app development in PhoneGap. Starting with their design and following through to their completion, you will develop real-world mobile applications. Each app uses a combination of core PhoneGap technologies, plugins, and various frameworks covering the necessary concepts you can use to create many more great apps for mobile devices.</p>
Table of Contents (21 chapters)
PhoneGap 3.x Mobile Application Development HOTSHOT
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Managing your project's platforms


We've created our first projects, but we haven't specified the platforms that the projects support. We'll add the iOS and Android platforms in this step and also show you how to manage the available platforms in your project.

Getting ready

It's important for your computer to be connected to the Internet as, while adding platforms, you may need to download platform-specific code.

Getting on with it

After creating your project, the next step usually involves adding the platforms the project will support. However, it's important to remember that you can also manage these platforms at any time. You can remove platforms, update platforms (in the case of an update to Cordova), and list out the supported platforms.

Adding platforms

To add the iOS and Android platforms (regardless of which CLI you used to create your project), open your terminal or command prompt, navigate to your project's directory, and type this:

cordova platform add ios android

Tip

Windows / Linux Users

You won't be able to add the ios platform, so just use cordova platform add android.

There may be a delay since each Cordova platform may need to download various platform files from the Internet. If you want to add other platforms, you can follow this pattern:

cordova platform add platform-name

Here, platform-name is any of the supported platforms, including the following:

  • ios: The iOS platform

  • android: The Android platform

  • blackberry10: The BlackBerry 10 OS platform

  • firefoxos: The Firefox OS platform

  • wp7: The Windows Phone 7 platform

  • wp8: The Windows Phone 8 platform

  • windows 8: The Windows 8 platform

Tip

In order to build or deploy a project for a given platform, you need to have the appropriate platform SDK installed and properly configured. If not, you may receive errors.

Lots of new files have been added in the merges, platforms, and plugins folders. These are the platform-specific portions of your project.

Listing the available platforms

At some point in the future, you may want to ask Cordova which platforms your project is configured to support. To find out, just type the following command:

cordova platform ls

You'll see output similar to this:

Installed platforms: android, ios
Available platforms: blackberry10, firefoxos

Removing platforms

To remove a platform, just type this:

cordova platform remove platform-name

This will remove the appropriate directories and files from your project.

Updating platforms

If you update Cordova, you may want to update your project's platforms as well. To do so, update Cordova first (sudo npm update -g cordova) and then type this:

cordova platform update platform-name

What did we do?

In this section, you added the iOS and Android platforms to your Hello World project. You also learned how to add additional platforms, list the installed and available platforms, remove platforms, and update platforms.