Google Gears


Published on

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

Published in: Technology, News & Politics
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Show sample
  • Google Gears

    1. 1. Google
    2. 2. What is it? <ul><li>Google quote </li></ul><ul><ul><li>“Gears is an open source project that enables more powerful web applications, by adding new features to web browsers.” </li></ul></ul>
    3. 3. Gears Application <ul><li>Application that passes javascript calls to the OS </li></ul><ul><li>Written in java. </li></ul><ul><li> </li></ul><ul><li>Bsd license </li></ul>
    4. 4. Google client <ul><li>gears_init.js </li></ul><ul><li>Supports: </li></ul><ul><ul><li>Android, chrome, firefox, safari, ie, opera </li></ul></ul><ul><li>1.5 years old </li></ul><ul><ul><li>Wifi-based geo-location october/2008 </li></ul></ul><ul><ul><li>Safari support september/2008 </li></ul></ul><ul><li> </li></ul><ul><li>Wordpress, zoho, gmail </li></ul>
    5. 5. Google’s self proclaimed features <ul><li>LocalServer </li></ul><ul><ul><li>LocalServer Cache and serve application resources (HTML, JavaScript, images, etc.) locally </li></ul></ul><ul><li>Database </li></ul><ul><ul><li>Database Store data locally in a fully-searchable relational database </li></ul></ul><ul><li>WorkerPool </li></ul><ul><ul><li>WorkerPool Make your web applications more responsive by performing resource-intensive operations asynchronously </li></ul></ul>
    6. 6. Getting started <ul><li><script src=&quot;gears_init.js&quot;></script> </li></ul><ul><li><script> </li></ul><ul><li>if (! || !google.gears) { </li></ul><ul><li>location.href = &quot;<your welcome message>&quot; + </li></ul><ul><li>&quot;&return=<your website url>&quot;; </li></ul><ul><li>} </li></ul><ul><li></script> </li></ul>
    7. 7. Parameters <ul><li>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. </li></ul><ul><li>icon_src: Provide the URL to a 48x48 icon for your application. The icon can be any format displayable by web browsers. </li></ul><ul><li>name: Provide the name of your application. This value can be up to 150 characters in length. </li></ul><ul><li>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; </li></ul><ul><li>return: Provide your application's URL. The user will be directed back to this URL when installation is complete. </li></ul>
    8. 8. Offline mode <ul><li>Google gears allow the user to store copies of the website files locally. </li></ul><ul><ul><li>Javascript </li></ul></ul><ul><ul><li>Html </li></ul></ul><ul><ul><li>Pictures </li></ul></ul><ul><ul><li>Even renderings of server side code. </li></ul></ul>
    9. 9. How it works <ul><li>Json file </li></ul><ul><li>Initiate localserver. </li></ul><ul><li>Create a store. </li></ul><ul><li>Add to the store by version. </li></ul><ul><li>Updates are completed via version number. </li></ul><ul><li>Discussion point - cache </li></ul>
    10. 10. Dynamic <ul><li>Ok, getting index is cool. But nothing is dynamic. </li></ul><ul><li>SQLite! </li></ul>
    11. 11. No data Layer
    12. 12. SqlLite data layer
    13. 13. More options = more work.
    14. 14. The perfect solutions
    15. 15. Main supported classes <ul><li>beta.database Database </li></ul><ul><li>beta.desktop Desktop </li></ul><ul><li>beta.geolocation Geolocation </li></ul><ul><li>beta.httprequest HttpRequest </li></ul><ul><li>beta.localserver LocalServer </li></ul><ul><li>beta.timer Timer </li></ul><ul><li>beta.workerpool WorkerPool </li></ul>
    16. 16. beta.database Database <ul><li>var db = google.gears.factory.create('beta.database'); </li></ul><ul><li>'database-test'); </li></ul><ul><li>db.execute('create table if not exists Test' + ' (Phrase text, Timestamp int)'); </li></ul>
    17. 17. Desktop <ul><li>var desktop = google.gears.factory.create('beta.desktop'); </li></ul><ul><li>desktop.createShortcut('Test Application', </li></ul><ul><li>'', </li></ul><ul><li>{'128x128': '', </li></ul><ul><li>'48x48': '', </li></ul><ul><li>'32x32': '', </li></ul><ul><li>'16x16': ''}, </li></ul><ul><li>'An application at '); </li></ul><ul><li>Files upload </li></ul>
    18. 18. GeoLocation <ul><li>var geo = google.gears.factory.create('beta.geolocation'); </li></ul><ul><li>Read only </li></ul>
    19. 19. HttpRequest <ul><li>var request = google.gears.factory.create('beta.httprequest'); </li></ul><ul><ul><li>'GET', '/index.html'); </li></ul></ul><ul><ul><li>request.onreadystatechange = function() { </li></ul></ul><ul><ul><li>if (request.readyState == 4) { </li></ul></ul><ul><ul><li>console.write(request.responseText); </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>}; </li></ul></ul><ul><ul><li>request.send(); </li></ul></ul><ul><li>Basically created specifically for the worker pool because it cant use the XmlHttpRequest. </li></ul>
    20. 20. Worker pool <ul><li>The WorkerPool API runs operations in the background, without blocking the UI. </li></ul><ul><li>Scripts executing in the WorkerPool will not trigger the browser's &quot;unresponsive script&quot; dialog. </li></ul>
    21. 21. Worker pool declaration <ul><li>var workerPool = google.gears.factory.create('beta.workerpool'); </li></ul><ul><li>var childWorkerId = workerPool.createWorkerFromUrl('worker.js'); </li></ul>
    22. 22. isolation <ul><li>Collection of processes, not threads. </li></ul><ul><li>No inheritance, no variable sharing, no share namespace </li></ul><ul><li>Interact via message objects </li></ul>
    23. 23. limitations <ul><li>No DOM access </li></ul><ul><ul><li>Document </li></ul></ul><ul><ul><li>window </li></ul></ul><ul><li>Most other functions are supported </li></ul>
    24. 24. Usage patern <ul><li>create a WorkerPool (wp) </li></ul><ul><li>Indicate where messages will go (wp.onmessage) </li></ul><ul><li>Create worker wp.createWorkerFromUrl() </li></ul><ul><li>Function returns immediately, parent continues too run. </li></ul>
    25. 25. State <ul><li>No new blog post in the last 6 months </li></ul><ul><li>Api documentation missing. </li></ul><ul><li>Very interesting market change </li></ul><ul><li>? </li></ul>