Book Image

PhoneGap Mobile Application Development Cookbook

By : Matt Gifford
Book Image

PhoneGap Mobile Application Development Cookbook

By: Matt Gifford

Overview of this book

<p>As more and more of our online life and daily activities evolve into the mobile landscape it has never been of more importance to start venturing into the world of mobile applications.<br />&nbsp;<br />With PhoneGap, you can put your existing development skills and HTML, CSS, and JavaScript knowledge to great use by creating mobile apps for cross-platform devices.<br /><br />"PhoneGap Mobile Application Development Cookbook" will show you how to create native mobile applications for multiple device platforms using the PhoneGap API. You will learn to build dynamic applications that interact with the native functionality on the device to create a rich, interactive experience for your users.<br /><br />This is a cookbook with each section written as a recipe in an informal, friendly style. Each recipe contains the complete code needed to build your applications, and plenty of screenshots showing the completed projects running on devices are included to assist you.<br /><br />"PhoneGap Mobile Application Development Cookbook" will introduce the PhoneGap API to you in clear, concise sections, breaking down each recipe to achieve realistic working projects that can be applied to your own mobile applications.<br /><br />You will be shown how to use the mobile development framework to build applications that can be deployed and run on multiple mobile platforms including iOS, Android, and BlackBerry.<br /><br />This book will explore the various methods and functions available using the API, and how to write code that interacts with the native functions, including geolocation sensors, contacts database, and native button events of the device to create powerful applications ready for the market place.<br /><br />"PhoneGap Mobile Application Development Cookbook" will help you break into the world of mobile application development. Build mobile applications in code you&rsquo;re comfortable with, create a richer user experience for your users and become part of the ever-growing mobile market place.</p>
Table of Contents (17 chapters)
PhoneGap Mobile Application Development Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Learning the basics of the XUI library


When creating applications that focus as heavily on user interactions as mobile apps do, we want to be able to easily update and manage the underlying HTML and data collections.

How to do it...

We'll make use of XUI's simple but powerful DOM traversal methods and the ability to extend the library functionality into custom code.

  1. Create the basic layout for the HTML page.

  2. Create a div element within the page with some text. In this case we're going for the globally recognized "Hello World" sample text. Set the id attribute for this element to content.

  3. Include a new script tag into the head of your document, and reference the XUI library within your project directory.

    <!DOCTYPE HTML>
    <html>
      <head>
        <meta name="viewport" content="user-scalable=no, 
             initial-scale=1, maximum-scale=1, 
             minimum-scale=1, width=device-width;" />
        <meta http-equiv="Content-type" 
        content="text/html; charset=utf-8">
        &lt...