• Save
Google Gears
Upcoming SlideShare
Loading in...5

Google Gears



Summary seminar of the possible functions and present state of google gears.

Summary seminar of the possible functions and present state of google gears.
For more useful information on similar topics visit www.silenceit.ca



Total Views
Views on SlideShare
Embed Views



2 Embeds 12

http://www.slideshare.net 7
http://www.silenceit.ca 5


Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment
  • Show sample

Google Gears Google Gears Presentation Transcript

  • Google
  • What is it?
    • Google quote
      • “Gears is an open source project that enables more powerful web applications, by adding new features to web browsers.”
  • Gears Application
    • Application that passes javascript calls to the OS
    • Written in java.
    • http://code.google.com/p/gears/
    • Bsd license
  • Google client
    • gears_init.js
    • Supports:
      • Android, chrome, firefox, safari, ie, opera
    • 1.5 years old
      • Wifi-based geo-location october/2008
      • Safari support september/2008
    • http://code.google.com/apis/gears/
    • Wordpress, zoho, gmail
  • Google’s self proclaimed features
    • LocalServer
      • LocalServer Cache and serve application resources (HTML, JavaScript, images, etc.) locally
    • Database
      • Database Store data locally in a fully-searchable relational database
    • WorkerPool
      • WorkerPool Make your web applications more responsive by performing resource-intensive operations asynchronously
  • Getting started
    • <script src=&quot;gears_init.js&quot;></script>
    • <script>
    • if (!window.google || !google.gears) {
    • location.href = &quot;http://gears.google.com/?action=install&message=<your welcome message>&quot; +
    • &quot;&return=<your website url>&quot;;
    • }
    • </script>
  • Parameters
    • action: Enables applications to customize the Gears install page to provide context during the installation process. There are two allowed values: install or upgrade. Use the install value to prompt the user to install Gears. Use the upgrade parameter if you detect that the version of Gears the user has installed is too old for your application (but note that Gears autodates itself, so typically the vast majority of users all have the latest version). Either of these values enable the rest of the customization parameters.
    • icon_src: Provide the URL to a 48x48 icon for your application. The icon can be any format displayable by web browsers.
    • name: Provide the name of your application. This value can be up to 150 characters in length.
    • message: Provide any text up to 150 characters. This message appears at the top of the installation page. For example: &quot;Install Gears to enable MyGreatApp's offline features!&quot;
    • return: Provide your application's URL. The user will be directed back to this URL when installation is complete.
  • Offline mode
    • Google gears allow the user to store copies of the website files locally.
      • Javascript
      • Html
      • Pictures
      • Even renderings of server side code.
  • How it works
    • Json file
    • Initiate localserver.
    • Create a store.
    • Add to the store by version.
    • Updates are completed via version number.
    • Discussion point - cache
  • Dynamic
    • Ok, getting index is cool. But nothing is dynamic.
    • SQLite!
  • No data Layer
  • SqlLite data layer
  • More options = more work.
  • The perfect solutions
  • Main supported classes
    • beta.database Database
    • beta.desktop Desktop
    • beta.geolocation Geolocation
    • beta.httprequest HttpRequest
    • beta.localserver LocalServer
    • beta.timer Timer
    • beta.workerpool WorkerPool
  • beta.database Database
    • var db = google.gears.factory.create('beta.database');
    • db.open('database-test');
    • db.execute('create table if not exists Test' + ' (Phrase text, Timestamp int)');
  • Desktop
    • var desktop = google.gears.factory.create('beta.desktop');
    • desktop.createShortcut('Test Application',
    • 'http://example.com/index.html',
    • {'128x128': 'http://example.com/icon128x128.png',
    • '48x48': 'http://example.com/icon48x48.png',
    • '32x32': 'http://example.com/icon32x32.png',
    • '16x16': 'http://example.com/icon16x16.png'},
    • 'An application at http://example.com/index.html ');
    • Files upload
  • GeoLocation
    • var geo = google.gears.factory.create('beta.geolocation');
    • Read only
  • HttpRequest
    • var request = google.gears.factory.create('beta.httprequest');
      • request.open('GET', '/index.html');
      • request.onreadystatechange = function() {
      • if (request.readyState == 4) {
      • console.write(request.responseText);
      • }
      • };
      • request.send();
    • Basically created specifically for the worker pool because it cant use the XmlHttpRequest.
  • Worker pool
    • The WorkerPool API runs operations in the background, without blocking the UI.
    • Scripts executing in the WorkerPool will not trigger the browser's &quot;unresponsive script&quot; dialog.
  • Worker pool declaration
    • var workerPool = google.gears.factory.create('beta.workerpool');
    • var childWorkerId = workerPool.createWorkerFromUrl('worker.js');
  • isolation
    • Collection of processes, not threads.
    • No inheritance, no variable sharing, no share namespace
    • Interact via message objects
  • limitations
    • No DOM access
      • Document
      • window
    • Most other functions are supported
  • Usage patern
    • create a WorkerPool (wp)
    • Indicate where messages will go (wp.onmessage)
    • Create worker wp.createWorkerFromUrl()
    • Function returns immediately, parent continues too run.
  • State
    • No new blog post in the last 6 months
    • Api documentation missing.
    • Very interesting market change
    • ?