In this video course, Chris Griffith introduces the PhoneGap ecosystem and the basics of Starting from the beginning, this book will cover how to set up your. Adobe Systems Incorporated. All Rights Reserved. Introduction to Mobile Development with PhoneGap. Yeah it's prey awesome. Build cross-platform mobile applications with the PhoneGap . Did you know that Packt offers eBook versions of every book published, with PDF and ePub .. This verifies that your setup is ready to begin writing PhoneGap applications for iOS.
|Language:||English, Spanish, French|
|ePub File Size:||15.58 MB|
|PDF File Size:||14.56 MB|
|Distribution:||Free* [*Sign up for free]|
The book provides an introduction and detailed tutorial on PhoneGap .. In the past, we have seen similar OS fragmentations, beginning with the cross-desktop. In this chapter, you'll learn the essentials of PhoneGap. Beginning App Development with Parse and Phonegap pp | Cite as Download chapter PDF. “Beginner” in this context not only encompasses those who might be beginning PhoneGap developers, but also those who may be extremely experienced and.
Apache Cordova 4 Programming by John M. The book is for mobile developers who want to learn about Apache Cordova 4. You should have at least some experience with mobile development to directly benefit from this book. Getting Started with PhoneGap 4 by Matthew Ray For the web developer who is ready to get into mobile app development, Getting Started with PhoneGap 4 guides readers through the intimidating task of preparing their system and beginning the journey into hybrid mobile app development with the PhoneGap framework. Apache Cordova in Action by Raymond K. Camden Apache Cordova in Action teaches you to create and launch hybrid mobile apps using Cordova or Phonegap. For readers just learning to design mobile apps, the book will discuss ways to build mobile friendly, professional-quality UI and UX.
Have the default site be google. Create an informational footer that contains information about the device the person is using. Checking for network connectivity Use connection. Creating custom alerts Create custom alerts with notification. Creating beeps Create beeps with confirmation. Creating vibrations Create vibrations with confirmation. What Is the Accelerometer? The accelerometer is a device that captures motion in the X, Y, and Z directions.
To help visualize the X, Y, and Z directions, place your device face-up on a flat surface, like a desk. Ideally, this surface would offer very little friction so that, for example, you can push the device left and right without having to lift it. Any which way you move the device will result in a change of coordinates, either into the positive or negative quadrants.
Moving it to the left gives you a negative result; moving it to the right gives you a positive result. Moving it away would result in a positive result along the axis; and moving it toward you would result in a negative result.
So far, so good. The Z direction represents up and down, adding a third dimension. If you were to drop the device under the surface or somehow push it through the surface! The accelerometer inside the device would detect all kinds of movement along the X, Y, and Z directions. Here are just three: All that person would have to do is turn on your application and put the device in a pocket. The idea behind this game is to guide a cute little monkey through a variety of obstacles by tilting and turning your iPhone.
The game was featured on the SyFy channel in the U. This object is created and populated by PhoneGap, and returned by an accelerometer method. Instead of giving you the current acceleration, it will report the last value reported from a PhoneGap accelerometer call. If you set a variable to contain the method call, and pass in a frequency parameter as one of the options, you will get acceleration data on a periodic basis.
A more useful function might be something like the following, in which certain document object model DOM elements are refreshed in the HTML, thus giving you a more functional readout, as shown here: PhoneGap will restrict the interval to a minimum of every 40 milliseconds ms and a maximum of every 1, ms.
So, if you request an update every 3, ms 3 seconds , PhoneGap will request an interval of 1, ms from the device, but invoke the success callback at your requested interval of 3, ms. As soon as the application loads, move your device around to get updates on its X, Y, and Z acceleration. How It Works As soon as the application loads, the startWatch function is fi red. This function uses the watchAcceleration method to start watching the accelerometer and reporting X, Y, Z, and timestamp information back to the HTML display.
You now know how to detect movement on the device in X, Y, and Z directions. In Chapter 7, you learn how to use the compass. Write an application that beeps if the device is held at a certain angle. Feel free to establish what those X, Y, and Z parameters should be. Acceleration object To capture read-only data about the current state of acceleration, use the data returned in the Acceleration object. What Is the Compass? Simply put, the compass built into your device obtains the direction in which the device is pointing.
Specifically, your device has a solid-state or digital compass. It uses two or three depending on the model of your device magnetic field sensors to supply data back to your device. The device uses this data to provide a correct heading with some rapid trigonometric calculations. If your device is any of the following, it also contains a magnetometer: This chapter does not go into detail about magnetometers.
Differences Among the Different Devices Just about all modern smartphones come with a built-in compass. All of them can provide you with a heading.
While the application is running, simply turn in different directions to display a heading. From a look-and-feel perspective, the various native compasses look slightly different, but they all provide pretty much the same amount of information. For example, the compass in the iPhone 3GS shown in Figure offers a visual compass that tells you where north is, plus a readout in degrees and cardinal points for example, NW of your heading.
At the bottom, it provides a GPS readout of your latitude and longitude. The compass in an Android device shown in Figure also offers a compass display with a heading, and lets you bookmark your current location. The compass in the iPhone 3GS in an Android device The compass in the BlackBerry Torch shown in Figure offers the same visual compass as the iPhone and Android, but includes a direction of travel, presumably an alternative to providing a degree heading.
Finally, the compass in a webOS phone shown in Figure offers just a compass display with a heading, and a button that links back to a map display. Using the Compass Why use the compass at all? Why would you want to create an application that contains a compass, if your device already includes a native compass application?
Well, for one thing, if you create an application that uses the Compass API, you can create more specific results than just a general heading. Here are just three creative ways to add a compass to any application: For example, if you were Muslim, knowing the current direction for Mecca would be very important for prayers.
This application is only for the iPhone 3G. Figure shows how this application also enables you to write notes about locations. Notes for To get the current heading, use compass.
This is an entirely optional item. If you set a variable to contain the method call, and pass in a frequency parameter as one of the options, you will get heading data on a periodic basis.
Following is an example of how to use this method: A more useful function might be something like the following, in which certain document object model DOM elements are refreshed in the HTML, thus giving you a more functional readout: Enter the following code. As soon as the application loads, tap the Start Watching button, and move your device to get heading updates.
This function uses the watchHeading method to start watching the compass, and reports heading information back to the HTML display. Copy the jqtouch and themes folders into your Xcode project.
The easiest way to do that is to right-click the www folder in Xcode and select Open With Finder, as shown in Figure Contents of the new www folder www. Stick the following code above the fi rst call to load phonegap.
Inside that DOM element is a second div with a class of toolbar. The DOM element with an id of heading comes after that. This is where the heading information will be placed.
After that comes an unordered list with two elements. This code uses the individual class to simulate having two buttons side by side. Display a special message if the device is oriented north. What Is Geolocation? Simply put, geolocation involves the identification of a real-world geographic location of a device — in this case, the smartphone you have with you. Because of the wide divergence of methods used www. Using Geolocation The most obvious reason to use geolocation is the recent trend to indicate where something happened.
Some existing applications also combine geolocation data particularly readings of latitude and longitude to pinpoint your location on a map, or add important information to a compass display. From your point of view as a developer, the biggest consideration you will have is how accurate geolocation data will be on any given device. Depending on the type of smartphone being used, the resolution in other words, accuracy will vary. Bad weather might cause interference with the GPS satellite, or the user might be indoors or underground and not getting good reception.
If the user is in a place where many stores, restaurants, and other landmarks are in close proximity to one another, the user might not get very accurate readings of where he or she is. Anyone who has used a social location service to check in to a bar has experienced this problem. Following are three creative ways you might add geolocation data to any application: Many Twitter users post geolocation data with their tweets, and you could use the Twitter search API to pull down tweets that are within a few miles of a smartphone user.
Both apps are free and available on lots of different device platforms. You can sign up and start using them right away. On Gowalla, you can take trips and pick up items that other players have left for you. You can then select a location from the list of nearby venues, add a note and a photograph, and post it to your stream.
Following are the two properties for this object: For example, calling geolocation. This function returns both an error code and an error message in case of a problem, encapsulated as a read-only PositionError object.
Coordinates Object The Coordinates object contains a set of read-only properties. In fact, the Coordinates data is attached to the Position object, which is then returned to the user via the onSuccess callback function. Following are the properties of the Coordinates object: The optional callback that is called in case of an error is geolocationError. The getCurrentPosition method is an asynchronous function that returns current position data. As mentioned earlier in this chapter, you use the onSuccess callback function to actually retrieve the position data, as shown here: If you set a variable to contain the method call, and pass in a frequency parameter as one of the options, you will get data on a periodic basis.
So, for example, the following options would set a maximum age of 5 seconds, a timeout of 5 seconds, and enable high accuracy: How It Works As soon as the application loads, the watchPosition method is fi red. Every 3 seconds the device will get a new update on longitude and latitude.
In fact, all it does is keep adding geolocation information to the screen until you turn it off. Rather bland geolocation UI www. Improved Figure shows the result. How can you improve it? Well, for one thing, you can simplify the return data from the onSuccess function. Instead of spewing out all that information, perhaps this would do: The information is more compact, certainly, and you could improve it even more with bolding and other tricks. You now know how to retrieve latitude, longitude, maybe some altitude , and other data points of your current position.
Write an application that displays a special message if the speed drops below a certain threshold. Feel free to set any threshold you like. What Are Media Files?
The Media API lets you record and play back audio on a device. You can typically play audio fi les loaded locally on the device, or play audio files retrieved from the Internet.
Furthermore, the capability to record audio has been pretty convenient, too. The audio quality was just fi ne, and it was easy to incorporate the resulting MP3 fi le into audio-editing tools. Showcase of Media Applications An abundance of voice recorders and music-playing applications exist for both iOS and Android devices — almost too many to mention here.
Figure shows just a partial list of voice recorders available on the App Store. All of these provide the same basic functions — record, pause, play, and stop recording.
Some offer the capability to share your recordings with others via e-mail, fi le sharing, or social media services. You can create all kinds of voice recordings, give them custom names, and even set an automatic start and stop time for recordings. The best way to learn about the Media API is to start learning about its methods. The methods allow you to play, record, and pause, among other things.
The getCurrentPosition method is an asynchronous function that returns the current position of the underlying audio file of a Media object, and is supported only on Android. To convert to seconds, you will need to divide by 1, If the duration is unknown, a value of -1 is returned.
Following is an example of an audio fi le being paused after 15 seconds a great way to offer up an audio sample, by the way: This is particularly important because there is a fi nite number of OpenCore instances for media playback. The OpenCore libraries support media playback for audio, video, and image formats.
You should always call this release function when you no longer need a media resource. It contains two parts: The predefi ned error codes are constants: That way, you could display the friendlier message to the user. The user can also play the same fi le by pressing the Play Audio button. How It Works As soon as the application loads, the user can start recording and stop recording using two links at the bottom of the HTML window.
It is also difficult to use because it uses links. Current media player application look and feel www. Place the following code above the fi rst call to load phonegap. The Play button has a class of whitebutton, and the other two buttons get a class of graybutton. The result is similar to what is shown in Figure Create an application that will start recording after a 5-second delay.
What Is the Camera? Just about every smartphone these days comes with a camera. There are absolutely no standards that govern megapixels, optical zoom, the existence of a flash, shutter speed, and ISO.
For the non-photographers, ISO is used to defi ne sensitivity to light — the higher the number, the more light is gathered. Therefore, it reduces the amount of flash, for example, that you might use in a low-light situation. Those that do offer different support for HD capture. Still others support removable memory cards. What Is the Photo Gallery? If your smartphone has a camera, it also has a photo gallery.
On most phones, the photo gallery usually displays a grid of thumbnail images, any of which you can tap to view a larger version of the image.
Android photo gallery photo gallery www. Figure shows what happens when you tap the share icon on an iOS device. Also, most devices have the capability to organize photos into photo albums. It is important to mention the photo gallery and photo albums because when you work with the Camera API, you have the option of taking a picture with the camera, or selecting an image from the gallery or photo albums.
Even those who would never consider themselves good photographers or who are intimidated by the options on a digital camera, or even a point-and-shoot camera can use their smartphones to capture memories. Here are just three creative ways to use the camera as part of any application: Flickr, which was one of the fi rst social photography services now part of Yahoo! You can easily view photos of your own and from your photo galleries of your friends with the app, as shown in Figure It contains a dozen modern and vintage photo effects that you can apply to your pictures.
You can even save multiple effects onto your images. Flickr photo subjects. The by-product of tilt-shifting is that the subjects appear to be little toys, as you can see in Figure Of course, if used selectively, it can also simulate depth-of-field to a certain degree. This object has one method, getPicture , which you learn more about shortly.
Following are the options for the Camera object: You use the camera. It then closes the camera application and returns the user to your application. The cameraSuccess callback function contains the image data from the camera operation. For example, the following code snippet shows how you would take an image with the camera at 35 percent quality and return the data as a Baseencoded image: The higher the number, the better the quality.
For example, the following options set quality to 70 percent, return a Baseencoded image, and allow editing the CAMERA is set by default: Table highlights some idiosyncrasies for various devices. BlackBerry Ignores the quality, sourceType, and allowEdit parameters. Application must have key injection permissions to close the native Camera application after a photo is taken. Taking a very large image may result in the inability to encode the image for later- model devices with higher-resolution cameras.
Palm Ignores the quality, sourceType, and allowEdit parameters. Enter the following: How It Works As soon as the application loads, the user can take a picture by clicking the Capture Photo button. This button triggers the capturePhoto function, which takes a picture with the default camera with a quality of 50 percent , and then stuffs the Baseencoded image into the myImage document object model DOM element in the HTML.
How It Works Instead of taking a picture with the default camera application, this example allows the user to select an image from the photo gallery or a photo album. Figure shows how the fi rst camera application looks on the device.
Ensure that your project has the necessary jQTouch folders in it, as described in Chapter 7. You get the idea. Using the button stand out blueButton class www. Create a 3-second delay before taking a photo. Add an option that allows the user to choose the quality of a photo taken with a camera.
In this chapter, you learn how to use HTML5 storage options directly in your code. You learn how to use each of them here. For the fi rst time, PhoneGap developers are able to create client-side applications that use a somewhat reliable database back end.
For example, if you use Chrome or Safari to visit html5demos. Now, at fi rst glance, this page appears to be powered by a traditional database like mySQL. Result of clicking Inspect Element If you click the Resources tab and then scroll down to the databases portion, you will see that that an html5demos database exists, and inside that is a table called tweets.
If this is more your speed, then the local and session storage methods are what you want. Figure shows the result of entering a value of hello for the sessionStorage variable, and a value of goodbye for the localStorage variable. Entering values for sessionStorage and localStorage If you still have the Resources tab open, scroll down to Session Storage to see the value of hello stored there, as shown in Figure In Figure you can see the value of goodbye stored in Local Storage.
Value of goodbye stored in Local Storage www. Well, the Session Storage objects are deleted when you close the browser window, but the Local Storage ones persist. Another thing to remember is that Storage objects are usually good for 5 MB to 10 MB of data, depending on the browser used. Well, some devices will already support these features, and, in that case, the PhoneGap API will defer to the device implementation. Specifically, you learn how to do the following: To open a database, use the window.
For example, you can run the following command: This object contains methods that let you execute SQL statements against a previously opened database. Also note that you can use whatever legal SQL statement you want. The example shows a select statement, but you could run others. Following is an example of a drop statement: If you need to run a whole bunch of queries at once, you can create a transaction, which then calls your queries, as shown here: You learn more about result sets next.
The transaction method provides you with a success callback. The executeSql method also provides you with success and error callbacks. What you get back from the success callback function is the SQLResultSet object, which contains the following three properties: This applies only if you ran an insert statement. This returns 0 if none were affected, as with a select statement. Each time you use it, you get back a row of data specified by the index you pass it.
But once you have that, you can start at the fi rst record retrieved, and process each row using results. The error codes themselves are constants, as shown here: Enter the following code to create a database app: How It Works As soon as the application loads and the device is ready, the code runs openDatabase to create a test database.
Following that, the code then runs a series of transactions that create a test1 database table, and inserts three records into that database.
Once that particular transaction runs, the success callback runs, which calls a second transaction that queries the database. The result of that function is to loop through the record set and display the names in the document object model DOM element with an ID of status. Figure shows what this might look like. That error will look something like Figure The localStorage object does exactly that, giving you access to the local storage interface.
To use it, invoke window. How It Works As soon as the app loads, the user can enter his or her fi rst name into the field. As he or she enters each key, the storeName function is triggered, which takes the value from the input field and stores it in the local storage variable called name. Finally, it displays this value in the result DOM element, as shown in Figure As soon as the user taps Done on the keyboard, or, for example, moves to another field, the storeName function will trigger.
So, the new code would look like this: Result of download on Wrox. You learned how to open a database; create transactions; execute SQL statements; and get, set, and remove local storage data. In Chapter 12, you learn about the fi lesystem. Apply the jQTouch look and feel to the database example. In this chapter, you learn how to work with fi lesystems, directories, and fi les.
At the end of the day, that access is usually fairly limited. What this chapter focuses on is what probably matters most to you: It has the following two properties: Directories are represented by DirectoryEntry objects, and fi les are represented by FileEntry objects.
In this section, you learn about the following: It has the following properties: Furthermore, DirectoryEntry has the following methods: It features two callback functions as parameters: Any of the following conditions will create an error: Following are the parameters for this method: It defaults to the current name if unspecified. Any of the following will create an error: NOTE Remember that directory copies are always recursive — that is, they copy all contents of the directory.
It is invoked with a FileError object.
This is a good way to allow input from users, but you probably want to add some kind of validation in case they decide to pass in a malicious string. The parameters consist of two callback functions: It is invoked with no parameters. Following are the parameters: This can be a relative or absolute path. In the event of an error for example, if you try to delete a directory that contains a fi le that cannot be removed , some of the contents of the directory may be deleted.
This object also has the following methods: It creates a FileWriter object associated with the fi le. Following are the properties: The exclusive flag causes the fi le or directory creation to fail if the target path already exists. It has two methods: In turn, two constants defi ne a local fi lesystem: Following is an example that requests the local fi lesystem: Files can be read as text, or as a Baseencoded data string.
This object has the following properties: Following is an example of how to do this: A FileWriter object is created for a single fi le, and, once created, it can be used to write to a fi le multiple times. By default, the FileWriter object writes to the beginning of the fi le, and will overwrite existing data.
Following are properties for this object: The FileWriter object has the following methods: You can specify optional parameters with the FileUploadOptions object. When you successfully upload a fi le, the results are stored in a FileUploadResult object. All errors are stored in a FileTransferError object. These options are stored in a FileUploadOptions object. The FileUploadOptions object has the following properties: If not set, it defaults to image. It contains one property, code, which is one of the following predefi ned codes: This exercise provides an example of how to take a picture with the camera, and then upload the fi le to the server.
Once the picture is taken by the user, the fi le URI of that stored image is passed to the uploadPhoto function, which bundles that URI along with some other options, and passes it all up to the remote server.
Specifically, you learned how to read from the fi lesystem including navigating directories and reading fi le data , writing to the fi lesystem, and uploading fi les to a remote server. In Chapter 13, you learn about working with contacts. Upload a photo from the photo gallery to a server. That being said, the PhoneGap Contacts API does a remarkably good job of letting users create, update, and fi nd contacts, all of which you learn about in this chapter.
You create a contact with the contacts. The best way to save a lot of this information especially, for example, when it comes to the arrays expected for phoneNumbers is to use the ContactField object. The ContactField object is a general-purpose wrapper that enables you to create a data field and then add it to a contact.
For example, if you want to store a number of e-mails for a contact, you could use something similar to the following: The ContactAddress object has the following properties: Following are the properties for this object: To run a search on the Contacts database, use the contacts.
These fields will be the ones that are returned.
Following is an example of how you can fi nd contacts: Contacts On Android 2. The categories property is not supported on Android 2. On Android 1. The fi rst three e-mail addresses will be stored in the BlackBerry email1, email2, and email3 fields, respectively.
The fi rst and second addresses will be stored in the BlackBerry homeAddress and workAddress fields, respectively. The name and title of the fi rst organization are stored in the BlackBerry company and title fields, respectively. A single thumbnail-sized photo is supported. The image will be scaled down before saving to the BlackBerry Contacts database.
ContactName On Android devices, note that the formatted property is partially supported. It will return the concatenation of honorificPrefix, givenName, middleName, familyName, and honorificSuffix but will not store the values.
It will return a concatenation of the BlackBerry firstName and lastName fields. On iOS devices, the formatted parameter is partially supported. It will return an iOS Composite Name, but will not store it.
ContactOrganization On Android 2. The fi rst organization name will be stored in the BlackBerry company field. The fi rst organization title will be stored in the BlackBerry jobTitle field.
On iOS devices, note the following: This object has one property, code, which is one of the following predefi ned codes: Once it retrieves the contact data, it loops through it, and then loops through the organizations object that is nested inside the result set. It then prints out the values stored in the object. You now know how to create new contacts, search for contacts, and work with the various contact fields.
Chapter 14 takes a look at how to capture video, audio, and images. Find all the contacts in your database who are doctors. In this chapter, you learn how to use the Capture objects and methods. Specifically, the success callback is invoked with an array of MediaFile objects, each describing a captured video clip fi le. It defaults to 1, but must be greater than or equal to 1. On Android and BlackBerry devices, be aware of the following: Recording lengths cannot be limited programmatically.
The video size and format cannot be altered programmatically. However, these parameters can be changed by the device user. One video is recorded per invocation. Well, the Capture API enables you to capture more than one audio clip at a time, making it somewhat useful in different contexts. Capturing audio is similar to capturing video, except that you use the navigator. You can process them in the same way you would video fi les, as shown here: Default is 1.
The audio recording format cannot be altered programmatically. On iOS devices, be aware of the following: One recording can be created for each invocation. The Capture API enables you to create an application that will take numerous image captures and then save them. Capturing an image is simple. Just use the navigator. The default is 1. Recognizing Quirks When Capturing Images You should be aware of a variety of device-specific quirks when you are capturing images. The image size and format cannot be altered programmatically; however, the image size can be altered by the device user.
One image is taken per invocation. The image size and format cannot be altered programmatically. When an error does occur, a CaptureError object is invoked that returns an error code. Bytes sent: This process enables the user to capture up to two images before the files are uploaded to a remote server using the uploadFile function. Once sent, the user sees a status update showing the confirmation code and the number of bytes sent.
Create an app that allows audio, video, or image capture options. Furthermore, you learned about the filesystem, and can work with the contacts database. The idea behind the application is to be able to capture information in whatever format photographically, for example, or with an audio recorder , and then send the captured information somewhere for later retrieval.
Once a note has been taken, the user should be allowed to add some metadata a title and description would be good. Furthermore, the application should probably add its own metadata behind the scenes timestamp, geolocation data, maybe more.
Finally, the application should then store the information locally and back it up to a remote server. You should capture audio, video, and image data with the Capture API because it provides a fairly easy and intuitive way to do this. You should capture text with a simple text field that uses the default keyboard on the device. Because users have four options for recording notes, the fi rst screen should probably just show a series of buttons that allow them to capture their notes in a certain format, or review a list of previously saved notes.
Finally, after that information has been entered, the application should store the note data in a local database, and then transmit the information up to a remote server for safekeeping. You add the four buttons and invoke the capture function with each, passing in the type of capture you want image, audio, video, or text.
Because there is no text capture in PhoneGap, what this does is show the previously hidden notes DOM element. In the screenshot, the Write Text button has been tapped to display the text field. You can use one function to show a DOM element and not worry about it working on different devices. If you have less code to worry about, you have less that could possibly go wrong for the user. Another thing you can do is perhaps make the text area a little wider and taller by adjusting the cols and rows attributes.
Figure shows a much roomier text field. Changing the size of the text area www. Either way, you want the users to end up in the same place: Essentially, what this should do is take you to the same place that the success callback takes you: Oh, yes, you also have to hide the notes and buttons!
Note that jQuery is used here, mostly out of convenience. If the user has opted to capture video, audio, or image data, he or she will have activated the success callback, which invokes the MediaFile object and the showMetadata function. Part of this function will be very similar to the saveNote function that is, show the metadata form, and hide the others.
Again, jQuery comes to the rescue, enabling you to quickly and easily append to hidden form fields that contain the filename and the file path for later reference, as shown here: NOTE The key to this assumption is that you know your way around whatever language you are using. Each language has its own way of dealing with POST data, so the details will be left to you.
First things fi rst — you must create a database and then put a table into that database to hold your information. The best place to do that is at the very top of the application, as shown here: The synch function must read what has been saved in the different form fields, save that information to the local database, and then use the fi le-transfer mechanism to push the fi le to the remote server as a backup. After that, it must show the original buttons again and hide all the rest of the DOM elements.
You must add some geolocation information to the notes you take. Admittedly, when you look at the fi nal code listing, it looks like a mess. For your future sanity, you might want to try to look at ways of breaking up this app.
This will help you understand what your app is doing, and make it easier to maintain in the long run — particularly if you decide to beef it up with more look and feel. This discussion has purposely not addressed the look and feel of this sample application. This application enables users to capture notes in different formats, save that information to the device, and then transmit it to a remote server.
Answer to Question 1 The following code snippet shows how you can open the Google homepage as soon as you detect that the PhoneGap application is online: Answer to Question 1 Following is an example of a simple HTML form that allows a user to enter a web address and then press a button to test the network connectivity: Answer to Question 1 Following is some example code to create a beep if the device is held at a certain angle: Answer to Question 1 Following is an example of how to display a special message if the device is oriented north, or not display a special message if it is not oriented north: Answer to Question 1 Following is an example of adding a Stop Watching button to a geolocation application: Answer to Question 1 Following is an example of an application that will start recording after a 5-second delay: Answer to Question 1 The following example shows how to create a 3-second delay before taking a photo: Answer to Question 1 Following is an example of how to ask the user to enter his or her fi rst and last name: Answer to Question 1 Following is an example of how to upload a photo from the photo gallery to a server: Answer to Question 1 The following shows an example of how to fi nd all the contacts in your database who are doctors: Answer to Question 1 Following is an example of an app that allows audio, video, or image capture options: It is a merging of jQTouch and iScroll both of which are described later in this appendix.
It is based on jQuery for easy app creation iOS only by using tags like tool, carousel, scrollable, sidebar, panel, and page. For more information, see www. This alleviates the need to rewrite legacy and mainframe applications to fit your modern infrastructure.
Instead, you can use them as is. User interface widgets include buttons, edge-to-edge lists, flippable views, icon containers, menus, progress indicators, scrollable views, side-by-side layouts, toggle buttons, tab bars, and much more.
CSS3 animations and transition effects are supported. Dojo Mobile framework For more information, see http: It is based on the Dojo Toolkit. See the earlier description of Dojo Mobile. It ships with just the code needed for each device. For more information, see http: Its primary feature is the capability to quickly process a batch of SQL statements within a single database transaction, which can even be loaded from a separate text file though Ajax. There is also support for the sequential processing of SQL statements within the same transaction.
If you need a database for your application, check out html5sql. It uses simple HTML to create projects, and is supposedly easy enough for anyone to master in minutes. Jo works with PhoneGap, most mobile browsers, desktop browsers, and even Dashboard widgets.
Built on the rock-solid jQuery and jQuery UI foundation, it is very easy to theme. It is perfect for WebKit mobile apps that need a lightweight, simple, and elegant persistence solution. It includes a project wizard to configure PhoneGap projects, enabling app development and deployment in a few clicks.
With it, you can create apps on the desktop, and then download them to your device to run. It comes with a oyalty-free distribution. It includes lots of sample code and a page handbook.
Its object-oriented programming model lets you build native-like apps for mobile devices.
Apache Cordova in Action by Raymond K. Camden Apache Cordova in Action teaches you to create and launch hybrid mobile apps using Cordova or Phonegap. For readers just learning to design mobile apps, the book will discuss ways to build mobile friendly, professional-quality UI and UX.
Instead of just showing short snippets of code to explain a particular API, the book is chock full of complete, contextual examples. The sample applications provide developers with applications they can run on every Cordova supported mobile device platform to see exactly what the API does, how it works and what the limitations are on each platform.
PhoneGap 3. To explore these topics, the book guides you through the development of several apps, including a productivity app, a path-recording app, and a game.
Approach: A practical guide written in a tutorial-style, this book walks you step-by-step through 12 individual projects to create real world apps. Each project moves through design and implementation of the app, and also provides suggestions to enhance it.
Who this book is for: If you are a mobile developer who is familiar with Phonegap basics and wants to quickly create some cool mobile applications with PhoneGap, this book is for you. No experience with Java, or ObjC is required.