You are previewing Programming Chrome Apps.
O'Reilly logo
Programming Chrome Apps

Book Description

Put your web app design skills to work by learning how to create powerful and portable Chrome Apps. With this practical book, you’ll learn how to build Google’s unique apps to behave just like native apps so they can interact with hardware devices, access external files, and send notifications. Chrome Apps run on any platform that supports the Chrome browser—including OS X, Windows, Linux, as well as Android and iOS. If you know how to work with HTML, CSS, JavaScript, and the DOM, you’re ready to get started.

Table of Contents

  1. Dedication
  2. Preface
    1. What You Should Already Know
    2. Why I Wrote This Book
    3. Navigating This Book
    4. Online Resources
    5. Conventions Used in This Book
    6. Using Code Examples
    7. Safari® Books Online
    8. How to Contact Us
    9. Acknowledgments
  3. 1. Your First Chrome App
    1. From Web Apps to Chrome Apps
    2. Running a Chrome App
    3. Using the Chrome Dev Editor
    4. Differences Among Chrome Apps, Chrome Extensions, and Hosted Apps
    5. Chrome App Restrictions
    6. More on the Manifest
    7. Permissions
    8. Debugging Chrome Apps
    9. Chrome Release Channels
    10. Publishing a Chrome App
      1. Self-Publishing
      2. Publishing on the Chrome Web Store
    11. Chapter Summary
  4. 2. Local Files, Sync Files, and External Files
    1. Local Files
      1. FileSystem and DirectoryEntry
      2. Showing Transient Messages
      3. Getting DirectoryEntrys
      4. Getting FileEntrys and Creating FileWriters
      5. Writing a File with the FileWriter API
      6. Reading a File
    2. Auto-Saving and Idle Events
    3. Sync Files
      1. How Syncing Works
      2. Making the Note App Sync
      3. Listening for the FileStatusChanged Event
      4. Showing File Status
      5. Finding Remote Copies on Google Drive
    4. External Files
      1. A Simple Editor
      2. Choosing Files and Directories
    5. Adding Backup by Using Retained File Entries
    6. Chapter Summary
  5. 3. Local Storage, Sync Storage, and IndexedDB
    1. Local and Sync Storage
      1. Setting and Getting Local Storage
      2. Implementing setParams and getParams
      3. Adding Color Options to the Simple Editor App
      4. Sync Storage
      5. Removing Items and Clearing Storage
    2. IndexedDB
      1. IndexedDB Objects and Method Chaining
      2. Opening a Database
      3. Adding Objects in a Transaction
      4. Retrieving Objects by Using an Index
      5. Mailing List Example
      6. Handling Forms
      7. Adding and Updating Records
      8. Deleting Records
      9. Counting Records
      10. Searching and Ranges
      11. Deleting a Database
      12. Importing Data
      13. Exporting Data
    3. Chapter Summary
  6. 4. Networking and Messaging
    1. Socket API
      1. How BSD Sockets Works
      2. Chrome Socket API
      3. Modules and Module Loading
      4. Wrapping the Socket API as an Object in a Module
      5. A Weather Report App
    2. The XMLHttpRequest API
    3. Identity API
      1. Accessing the Facebook API
      2. A Facebook Photos App
      3. Accessing Google APIs
    4. WebSockets
      1. WebSockets API
      2. Example WebSocket Server
      3. Example WebSocket Client
    5. Google Cloud Messaging
      1. Example Application Server
      2. Example Client
      3. Summary of IDs, Numbers, and Keys
    6. App-to-App Messaging
    7. Notifications
    8. Chapter Summary
  7. 5. Graphics and Imaging
    1. Outputting Graphics
      1. Calendar Example
      2. Rendering the Calendar as Text
      3. Rendering the Calendar as a Table
      4. Rendering the Calendar as Positioned HTML
    2. HTML5 Canvas
      1. A Simple Canvas Example
      2. Drawing the Calendar by Using a Canvas
    3. Scalable Vector Graphics (SVG)
      1. Another SVG Example
      2. Differences Between Canvas and SVG
      3. Drawing the Calendar by Using SVG
    4. Creating PDFs
      1. A Simple PDF Example
      2. Outputting the Calendar as a PDF
    5. Working with Images
      1. Accessing Image Thumbnails and Metadata
      2. Image Rendering Quality
    6. The mediaGalleries API
      1. The Principal mediaGalleries API Methods
      2. A Media Browser
    7. Chapter Summary
  8. 6. Miscellaneous APIs
    1. Alarms
    2. Context Menus
    3. Location
    4. Text-to-Speech
    5. System Queries
    6. Camera
    7. Bluetooth, USB, and Serial APIs
    8. Internationalization and Localization
      1. Internationalizing and Localizing Strings
      2. Internationalizing Numbers
      3. Internationalizing Dates
    9. Chapter Summary
  9. A. Modal Dialogs
  10. B. Registering Chrome Apps with Google
    1. Registering a Chrome App and Getting a Client ID
    2. Fixing the App ID
  11. C. Using Google Cloud Messaging
    1. Setting Up a GCM Project
    2. Example App Server
    3. Using Amazon Simple Notification Service
  12. D. Using Cordova to Build Chrome Apps for Mobile Devices
    1. Google’s Augmentation of Cordova
    2. Development Tools and Debugging for Cordova
      1. Creating and Testing Cordova Chrome Apps
      2. Debugging Cordova Apps
      3. Publishing Cordova Chrome Apps
      4. Testing Using the Chrome Dev Editor
  13. Index
  14. About the Author
  15. Colophon
  16. Copyright