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

Defining the data model


We only have one new data model, much like the previous chapter. In this case, we need to create a model for an image note.

Getting on with it

Like the audio note we defined in the previous project, we will be inheriting the functionality from BaseNote for the image note. This is what the model looks like:

Like the audio note, there's not a lot that needs to be done because the BaseNote class does most of our work. Let's go over the changes:

  • A camera property will store a reference to a CameraManager instance. We'll define this in the next section; it lets us talk to the Camera API. It serves the same purpose as the media property on an audio note.

  • _updateUnit will calculate the size of the image.

  • _updateModificationDate will update the modification date after an image is taken.

  • getFormattedUnitValue will override the version of BaseNote. To make things a little easier to read, we'll convert the file size to kilobytes or megabytes if the file is large enough (rather than...