It’s been a month since Myk Melez posted an introduction to r2d2b2g, a prototype Firefox add-on that makes it easy to try out B2G (Mozilla’s new, completely web platform-based mobile OS) on your desktop/laptop computer. Just as B2G is growing up to become Firefox OS, r2d2b2g is growing up to become the Firefox OS Simulator.
Quite a bit has changed since Myk’s blog post, so I’ll give a run through of the Simulator as it stands today. The biggest difference between the early r2d2b2g releases and the latest is that it is now much easier to install apps that you’re working on into the Simulator. Let’s take a look!
The Simulator has moved into the Web Developer menu.
The Simulator also integrates with the command line on the Developer Toolbar. Use the
firefoxos manager command to jump into the Simulator Manager, just as the menu item does.
Here’s the Simulator Manager itself:
On the left, you’ll find some navigation controls including a switch that lets you start and stop the Simulator. The Simulator itself is still B2G Desktop, which is a build of B2G that runs natively on Windows, Mac and Linux. You can also start and stop the Simulator using the
firefoxos start and
firefoxos stop commands in the Developer Toolbar. The “JS Console” checkbox allows you to start up B2G Desktop’s Error Console so that you can spot errors that might arise while you’re working on your apps.
In the screenshot above, you’ll see that I’ve already installed a couple of apps. You can add apps by providing a URL to a site (with autocompletion based on your open tabs) or, even better, a URL to a manifest (so that the app can have a proper icon and such). You’ll need a manifest file anyhow to submit to the Firefox Marketplace, so you might as well start out with that early on.
You can also locate a manifest file on your local computer so that you can create a packaged app (no web server required!).
In the screenshot above, you’ll see that I installed James Long’s Weather Me app straight from GitHub and Fred Wenzel’s Serpent game from a local clone of its git repository. I’ll note that I did have to tweak the manifest for Serpent a little bit, because it was set up to deploy to GitHub rather than from its local directory. Changing just a couple of fields was all it took and then it worked great!
With those set up, I clicked the switch that says “Stopped” to fire up the Simulator. Then, I unlocked it with a swipe of the mouse, and swiped left on the home screen to get to my apps:
As you can see, the Weather Me and Serpent apps are installed and ready for testing! One new feature I’d like to point out is the home button at the bottom of the Simulator. You no longer have to guess which key to press on your keyboard… just click the on-screen button as you would on a phone.
While hacking away on these apps, if I make changes I just have to follow some simple rules to see my changes. Hosted apps follow the usual rules for website caching and for working with appcache (which you should!). You can update packaged apps just by clicking the Update button in the dashboard and restarting the Simulator.
Once you’re done working with an app, you can remove it from the manager, which will also remove it from the Simulator (though you made need to restart your Simulator to see it disappear).
The Firefox OS Simulator is the easiest way to try out Firefox OS apps today and to verify how they’ll look before submitting them to the Marketplace.