{"id":401,"date":"2011-12-03T21:19:45","date_gmt":"2011-12-03T19:19:45","guid":{"rendered":"http:\/\/blogs.igalia.com\/juanjo\/?p=401"},"modified":"2011-12-03T21:19:45","modified_gmt":"2011-12-03T19:19:45","slug":"open-web-apps-and-device-apis","status":"publish","type":"post","link":"https:\/\/blogs.igalia.com\/juanjo\/2011\/12\/03\/open-web-apps-and-device-apis\/","title":{"rendered":"Open web apps and device APIs"},"content":{"rendered":"<p>During the past couple of weeks I have been (together with <a href=\"http:\/\/blogs.igalia.com\/alex\/\">some<\/a> <a href=\"http:\/\/blogs.gnome.org\/xan\/\">other<\/a> colleagues at Igalia) checking the different solutions that the main actors in the &#8216;open web&#8217; are proposing to enable the local installation of web apps and the interaction with the underlying platform or device, in some cases going beyond the standard HTML5 interfaces.<\/p>\n<p>I will try to give here a high level overview of the alternatives and also provide a few links that can be useful for those interested in the topic.<\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<ul>\n<li><strong>W3C<\/strong><\/li>\n<\/ul>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p>In 2006, the W3C started to work in the definition of <a href=\"http:\/\/www.w3.org\/2008\/webapps\/wiki\/WidgetSpecs\">W3C\u00a0Widgets<\/a>. Despite what the name may suggest, those &#8216;widgets&#8217; are\u00a0actually complete apps developed using HTML5 technologies\u00a0(HTML\/CSS\/JavaScript), packaged as compressed files, which include an\u00a0XML manifest with metainformation. You can read a more detailed explanation about what &#8216;widgets&#8217; are and what they are not in <a href=\"http:\/\/www.w3.org\/community\/native-web-apps\/2011\/10\/09\/misconceptions-about-w3c-widgets\/\">this\u00a0series of blog posts<\/a> published recently in the W3C community\u00a0pages.<\/p>\n<p>Three years later, in 2009, the W3C started to work on another\u00a0complementary standard called <a href=\"http:\/\/www.w3.org\/2009\/dap\/\">DAP (Device API)<\/a>, an extension of the\u00a0HTML5 APIs that would allow a more complete access from DAP enabled apps to the system where they are running, including  interactions\u00a0with battery, camera, contacts, basic messaging, network,\u00a0vibrator, sensor and calendar.<\/p>\n<p>These two standards were used by some third parties, sometimes\u00a0partially modifying them, and in other cases taking them as inspiration for pretty different\u00a0and incompatible solutions (<a href=\"http:\/\/xkcd.com\/927\/\">leading to\u00a0a well known situation<\/a>). We will see now the main alternatives that have\u00a0appeared during the past couple of years.<\/p>\n<ul>\n<li><strong>WAC<\/strong><\/li>\n<\/ul>\n<p>At Mobile World Congress 2010, in Barcelona, 24 major operators <a href=\"http:\/\/www.lightreading.com\/document.asp?doc_id=187950\">announced\u00a0WAC (Wholesale Applications Community)<\/a>, an industry consortium to\u00a0create an open platform for developing and distributing HTML5-based\u00a0mobile apps.<\/p>\n<p><a href=\"http:\/\/www.wacapps.net\/web\/wac\/wiki\/-\/wiki\/Developer%20Guide\/WAC+API's+and+their+differences#10\">WAC\u00a0defines APIs<\/a> for interaction with the device&#8217;s camera, contacts, calendar, tasks, messaging\u00a0(basic), accelerometer, device status, filesystem, device interaction\u00a0(lights, vibration), orientation, geolocation. They are similar but not totally compatible with W3C APIs.\u00a0There is a <a href=\"http:\/\/www.youtube.com\/watch?v=A2lXAXmAsKw\">multiplatform\u00a0SDK<\/a> based on Eclipse and the Android emulator which automates the\u00a0process of creating the package with the XML manifest and the \u00a0HTML\/JS\/CSS files, and testing it.<\/p>\n<p>The consortium is currently working on the 3.0 release of the WAC API spec, which\u00a0according to the (lack of) information available in their webpage is being defined\u00a0privately, making participation of those external to the consortium\u00a0extremely difficult. Also, the channel for application distribution is\u00a0proprietary, so although WAC is based on open standards, the solution\u00a0is quite closed and seems not attractive for open source projects.<\/p>\n<ul>\n<li><strong>Chrome<\/strong><\/li>\n<\/ul>\n<p>A bit later, still in 2010, at the same time <a href=\"http:\/\/cnettv.cnet.com\/8301-13991_53-20005408-10391624.html\">they\u00a0announced the Chrome web store<\/a>, Google defined two possibilities in order to install web apps in the browser: hosted apps and\u00a0packaged apps.<\/p>\n<p><a href=\"http:\/\/code.google.com\/chrome\/apps\/docs\/developers_guide.html\">Hosted\u00a0apps<\/a> are a classical webpage which provides a JSON manifest\u00a0(similar to the one that had been defined for the W3C widgets)\u00a0including the launch URL, basic data, autoupdate settings, permission\u00a0for accessing each of the standard HTML5, and a few other\u00a0bits. Providing the manifest enables easier installation and<br \/>\nsimplifies and speeds up a bit the opening of the webpage, but that&#8217;s\u00a0all.<\/p>\n<p><a href=\"http:\/\/code.google.com\/chrome\/extensions\/apps.html\">Packaged apps<\/a> go a step beyond. They are webapps that are bundled into\u00a0a .crx file (a Zip file, same format used for Chrome extensions), they\u00a0can use most of the <a href=\"http:\/\/code.google.com\/chrome\/extensions\/api_index.html\">Chrome\u00a0extension API<\/a> (only the creation of page actions and browser\u00a0actions are not allowed), and are limited to 10MB of total\u00a0size. Packaged apps include the same kind of manifest than hosted apps\u00a0(this time describing also permissions for accessing the Chrome\u00a0extension API modules), so they are similar to (but incompatible with) the\u00a0W3C Widgets. There are <a href=\"http:\/\/code.google.com\/chrome\/extensions\/apps.html\">various\u00a0reasons<\/a> why this kind of apps make more sense than a hosted app\u00a0for some use cases.<\/p>\n<p>It is worth noticing, for those less familiar with the terms, that\u00a0packaged apps, although they use the Chrome extension API, are\u00a0<a href=\"http:\/\/code.google.com\/chrome\/webstore\/articles\/apps_vs_extensions.html\">something totally different<\/a>. Extensions don&#8217;t have their own UI and\u00a0are complementing the behaviour of the browser, typically for all the\u00a0webpages, while packaged apps are actual web apps with their own UI, that are designed to run locally.\u00a0There are \u00a0<a href=\"http:\/\/code.google.com\/chrome\/webstore\/docs\/choosing.html\">instructions<\/a> available which clarify when hosted apps, extensions\u00a0and packaged apps are typically used.<\/p>\n<p>Although Google&#8217;s proposals are well documented, they seem to be clearly targeting their own app store, and not the open web. There is not a description of how somebody could install Chrome web applications from their own webpage.<\/p>\n<p>As far as I know, Google hasn&#8217;t defined a solution similar to DAP&#8217;s or WAC&#8217;s device APIs so far, so their proposal for device interaction would be to use just standard HTML5 interfaces.<\/p>\n<ul>\n<li><strong>Mozilla<\/strong><\/li>\n<\/ul>\n<p>More recently, in February 2011, Mozilla announced that they were\u00a0working on what they call <a href=\"https:\/\/developer.mozilla.org\/en\/OpenWebApps\">Open Web\u00a0Apps<\/a>. The idea is pretty similar to W3C&#8217;s Widgets and Chrome&#8217;s\u00a0hosted apps: ordinary web apps plus a JSON manifest with very similar\u00a0but yet again slightly incompatible fields. The main two additions are\u00a0a &#8216;widget&#8217; field where you can point to an HTML file that would be a\u00a0simplified version of your standard UI, and a few well\u00a0documented hooks in order to enable the creation of app stores not\u00a0controlled by Mozilla (e.g. navigator.mozApps.install,\u00a0navigator.mozApps.amInstalled JavaScript functions).<\/p>\n<p>Even more recently, in August 2011, they announced <a href=\"http:\/\/hacks.mozilla.org\/2011\/08\/introducing-webapi\/\">WebAPI<\/a>,\u00a0an extended HTML5 API specially designed for phones, similar to W3C&#8217;s\u00a0DAP and WAC, but again not compatible.\u00a0WebAPI includes APIs for telephony&amp;messaging, contacts, battery, contacts,\u00a0camera, filesystem, device status, settings, accelerometer, mouse\u00a0lock, vibrator, and more. Although the work has just started, \u00a0there are already\u00a0<a href=\"http:\/\/johnhammink.blogspot.com\/2011\/11\/lets-have-look-at-some-recently-landed.html\">some examples<\/a> of applications working on Android using some bits\u00a0of WebAPI.<\/p>\n<p><a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=673923#c8\">This\u00a0comment in Mozilla&#8217;s bugzilla<\/a> is relevant if you are trying to\u00a0understand why they are not considering using WAC&#8217;s APIs directly. And\u00a0<a href=\"http:\/\/lists.w3.org\/Archives\/Public\/public-webapps\/2010OctDec\/0159.html\">this\u00a0email to one W3C mailing list<\/a> is relevant to understand why they\u00a0didn&#8217;t use W3C&#8217;s DAP either.<\/p>\n<p>As far as I know, Mozilla doesn&#8217;t have the equivalent to Chrome&#8217;s packaged apps, or &#8216;W3C Widgets&#8217;, and they are focusing the work more on open web apps and the extended device APIs.<\/p>\n<ul>\n<li><strong>Summary<\/strong><\/li>\n<\/ul>\n<p>The W3C, Google, Mozilla, WAC and others have been working for the past three years on defining proposals for the installation of web apps and the interaction with the underlying system\/device from them. Although unfortunately\u00a0<a href=\"http:\/\/www.brucelawson.co.uk\/2011\/installable-web-apps-and-interoperability\">the situation is quite fragmented<\/a>, given that the solutions are quite similar, it is possible to imagine a convergence in the near future, that would benefit (almost) everybody. There have been already <a href=\"http:\/\/scottbw.wordpress.com\/2011\/08\/25\/mozilla-web-api-friend-or-foe\/\">positive statements<\/a> by some of the key players.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>During the past couple of weeks I have been (together with some other colleagues at Igalia) checking the different solutions that the main actors in the &#8216;open web&#8217; are proposing to enable the local installation of web apps and the interaction with the underlying platform or device, in some cases going beyond the standard HTML5 &hellip; <a href=\"https:\/\/blogs.igalia.com\/juanjo\/2011\/12\/03\/open-web-apps-and-device-apis\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Open web apps and device APIs<\/span><\/a><\/p>\n","protected":false},"author":23,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7,13,14,15],"tags":[],"class_list":["post-401","post","type-post","status-publish","format-standard","hentry","category-freesoftware","category-igalia","category-technology","category-webkit","category-webkitgtk"],"_links":{"self":[{"href":"https:\/\/blogs.igalia.com\/juanjo\/wp-json\/wp\/v2\/posts\/401","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.igalia.com\/juanjo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.igalia.com\/juanjo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.igalia.com\/juanjo\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.igalia.com\/juanjo\/wp-json\/wp\/v2\/comments?post=401"}],"version-history":[{"count":0,"href":"https:\/\/blogs.igalia.com\/juanjo\/wp-json\/wp\/v2\/posts\/401\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.igalia.com\/juanjo\/wp-json\/wp\/v2\/media?parent=401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.igalia.com\/juanjo\/wp-json\/wp\/v2\/categories?post=401"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.igalia.com\/juanjo\/wp-json\/wp\/v2\/tags?post=401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}