Programming Chrome Apps

Programming Chrome Apps

Language: English

Pages: 274

ISBN: 1491904283

Format: PDF / Kindle (mobi) / ePub


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.

Author Marc Rochkind takes you through a hands-on, objective tour of Chrome Apps, which 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.

  • Learn how to build, run, and debug Chrome Apps step-by-step
  • Use Chrome Apps to access local files, sync files, and external files
  • Take advantage of key-value-pair APIs, including sync storage and IndexedDB
  • Use WebSockets, Google Cloud Messaging, and other networking methods
  • Display graphics and images with Canvas, SVG, and the Media Galleries API
  • Use alarms, context menus, location, the camera, Bluetooth, USB, and other APIs
  • Publish apps to the Chrome Web Store with the Chrome Dev Editor

 

 

 

 

 

 

 

 

 

 

 

 

modeled on XMLHttpRequest exactly, both to provide an ex‐ ample of how you use sockets, and to provide an in-depth explanation of what XMLHttpRequest actually does under the covers. Incidentally, although XMLHttpRequest is at the heart of the Ajax technique, which is widely used for dynamic websites, it has little to do with XML and, in fact, is just as often used with JSON, as we did. 94 | Chapter 4: Networking and Messaging The name Ajax started out life presented in all uppercase (AJAX)

access the site, other than changing the password. (Deleting the app from your computer isn’t an option if it’s actually a website.) • Permissions are all-or-nothing. There’s no way to provide permission to access the site but not update it; when the app is logged in, it has all the privileges of a user. A few years ago an API called OAuth became widely available. With OAuth, you don’t provide your login and password to an app that needs to log in; rather, the app contacts the website you’re

holdouts, such as Flickr. You can use chrome.identity.launchWebAuthFlow for part of the authorization, but you still have a lot of work to do with some complicated XMLHttpRequest calls that you need to build up yourself. I don’t want to go into the gruesome details here, because they’re not unique to Chrome Apps, but I did make them available in a Flickr example app that you can find in the online example code for this book. There’s one more method to look at: Facebook.call, which makes Facebook

rest of the message in its window. Example Client The Chrome App client displays the last 10 status updates, as shown in Figure 4-11. Figure 4-11. Last 10 bus-status updates The first thing a GCM client has to do is get a registration ID so it can tell the app server where to send messages. This is done with chrome.gcm.register: 116 | Chapter 4: Networking and Messaging chrome.gcm.register(senderIDs, callback) senderIDs is an array of sender IDs, which are project numbers assigned by

Indexing Services, Inc. Cover Designer: Ellie Volckhausen Interior Designer: David Futato Illustrator: Rebecca Demarest First Edition Revision History for the First Edition: 2014-12-12: First release See http://oreilly.com/catalog/errata.csp?isbn=9781491904282 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Programming Chrome Apps, the cover image of a crested screamer, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the

Download sample

Download