Cloud Printer – Print from Firefox Mobile

Recently, Google released the beginnings of a cloud-based printing system called – Google Cloud Print. The project is still in Beta, but you can install a recent version of Google Chrome on Windows and attach your local printers into the Cloud Print system (more). Google has added support for Cloud Print to few of their mobile web apps, but has not released a client application API yet. However, they did release a simple webapp demo – and where there is a demo, there are people reverse engineering it.

Cloud Printer is a restartless Firefox Mobile add-on that integrates into the Google Cloud Print system. Firefox Mobile already has code to save web pages as PDF. I took that code and send the PDF to the Google Cloud Print system.

Using the demo code and some other examples, it was fairly simple to get this to work. The current API is fairly simple and nice. I expect a few changes when the APIs become official, which should happen soon.

Note: You need to be signed into your Google Account for this to work. If you are not signed in, you’ll see a prompt and we open the Google Account login page for you.

Let me know how this works for you!

Restartless Fun

I like experimenting with restartless add-ons. This time I used a variation of the include technique to assign an image to the toolbar button and get access to a CSS file and IPC frame script. The CSS file is loaded and unloaded using nsIStyleSheetService. The IPC frame script is loaded using the global message manager. The frame script is needed because the PDF file must be generated in the content process, not the main process. You do remember that Firefox Mobile is multi-process, right?

One gotcha. Once loaded, you can’t currently unload a IPC frame script. So if you enabled/disable a restarless add-on that loads a frame script, you’ll end up with multiple instances running. Which means, when you send an IPC message, multiple listeners will respond – this is bad. I hacked around that by sending a “disable” message to my frame script when uninstalling the add-on. The “disable” message just removes the message listeners in the frame script so they won’t respond to any messages in the future. See the source code.

These restartless techniques are documented in various places, but we should start some code snippet docs on MDC too.

6 Comments

  1. Cloud Printer extension enables printing from Firefox mobile | Motorola Droid X said,

    April 11, 2011 @ 11:54 am

    […] As noted by developer Mark Finkle, because Google never made the API available, a lot of back ground script work had to be done in order to get things working correctly. With that noted, Mark has welcomed everyone to try it out and report back on how it is working for them. You can hit the source link for the full details and how to get started with cloud printing on Firefox Mobile. [Cloud Printer add-on, Stark Raving Finkle] […]

  2. Cloud Printer extension enables printing from Firefox mobile | Andro Crypt said,

    April 11, 2011 @ 11:58 am

    […] As noted by developer Mark Finkle, because Google never made the API available, a lot of back ground script work had to be done in order to get things working correctly. With that noted, Mark has welcomed everyone to try it out and report back on how it is working for them. You can hit the source link for the full details and how to get started with cloud printing on Firefox Mobile. [Cloud Printer add-on, Stark Raving Finkle] […]

  3. Cloud Printer Extension Enables Printing From Firefox Mobile | AndroidFC said,

    April 11, 2011 @ 12:05 pm

    […] full details and how to get started with cloud printing on Firefox Mobile. [Cloud Printer add-on,┬áStark Raving Finkle] [Via […]

  4. Cloud Printer extension enables printing from Firefox mobile | Celebs, News and Gossips said,

    April 11, 2011 @ 12:33 pm

    […] As noted by developer Mark Finkle, because Google never made the API available, a lot of back ground script work had to be done in order to get things working correctly. With that noted, Mark has welcomed everyone to try it out and report back on how it is working for them. You can hit the source link for the full details and how to get started with cloud printing on Firefox Mobile. [Cloud Printer add-on, Stark Raving Finkle] […]

  5. Cloud Printer extension enables printing from Firefox mobile « android-alert said,

    April 11, 2011 @ 1:14 pm

    […] full details and how to get started with cloud printing on Firefox Mobile. [Cloud Printer add-on, Stark Raving Finkle] Cloud Printer extension enables printing from Firefox mobile posted originally by Android Central […]

  6. Download Cloud Printer add-ons for Firefox 4, Print from your Android Phone’s browser said,

    April 12, 2011 @ 5:24 am

    […] link. Stay tuned with us at Facebook and Twitter to get update on latest Android development. source. This entry was posted in Android Applications, Productivity, Tools Applications and […]

RSS feed for comments on this post