Moving a Chrome Packaged App to Mobile via Cordova/PhoneGap

A few weeks ago I wrapped a D3 visualization inside a Chrome packaged app, and put the app on the Chrome app store.  This allows someone to run the visualization on their desktop without having to connect to a web site, or even be online.

I just learned of an interesting project that is working to wrap Chrome packaged apps in PhoneGap/Cordova so that it can then work on Android and iOS mobile devices.

The project is on github here:
There is some activity going on there, with a commit a few days ago.

Here's a talk from PhoneGap Day US 2013 in October (found originally on the phonegap blog) by one of the lead developers (Mochal Mocny from Google) discussing the project.

A while back I played with wrapping a D3 app in phonegap, and it was dog slow, likely due to many inefficiencies of my own making that would require some concentrated jank busting in a mobile context.  Projects like this one from Google might deal with at least some the jank in a central way, which is exciting.

Here are some of the features he highlighted in the talk
  • Goals
    • improve Cordova's core offering
    • create a compatibility layer, allowing Chrome Apps to run on top of Cordova
    • Re-implement Chrome App APIs as Cordova plugins
  • Target iOS and Android
  • Working on App Harness
  • Wrote Cordova plugins to emulate (among other things):
    • Chrome App lifecycle
    • Parsing of Chrome App manifest.json
  • They have some scripts to help set up everything for wrapping a Chrome app; these read your manifest.json file and pull the plugins you need (this is very cool - can't wait to play with it)
  • Simplified OAuth2 flow ("trivial access to Google services" - his snippet from a sample manifest certainly suggested this is the case)
  • HTML5 FileSystem where users can use their Google Drive account
    • syncFileSystem api
    • syncs across devices and desktop
    • works offline, with two conflict policies
      • last write wins (for single user apps this is probably sufficient, so might not need to get messy with this)
      • manual (ugh)
  • Access to TCP/UDP raw sockets ("not just web sockets")
    • no need to middle-man for various web services
    • build peer-to-peer games

His live set up and run/conversion of an app to iOS did not work, unfortunately, but that's how these things go. He did show a video of an app using the Chrome socket api on an iPhone, where he had it control a quadricopter.

It will be interesting to see if this is how Google ultimately brings Chrome apps to mobile, or if they also developer a "more native" approach.

Exciting stuff.





Popular Posts