Brian LeRoux on PhoneGap

This article first appeared in issue 226 of .net magazine – the world's best-selling magazine for web designers and developers.

Once upon a time, building apps for different mobile devices was a nightmare. First you’d have to learn Objective C to create your iPhone app. Then you’d have to start all over again to create apps for Android, BlackBerry, Palm, Symbian … learning a completely new language each time.

But the open source platform PhoneGap changes all that. All you need do is code your app in HTML, CSS and JavaScript and PhoneGap will convert it to work on different devices. It even gives you access to native features such as a phone’s camera, contacts and accelerometer. And Brian LeRoux of PhoneGap’s creator Nitobi is keen to spread the good news.

But while he’s PhoneGap’s best-known evangelist, he’s no zealot, cheerfully accepting that other tools may meet your needs better. “Philosophically there is no golden hammer,” he says. “It’s a good habit for any software developer to go and investigate all the possibilities for yourself.” He recommends, for example, that you investigate Corona if you’re a game developer. “But if you’re a web developer and you want to reuse some of your logic – if not most of it – from your mobile website, or you’re looking to build a mobile website and then progressive-enhance it to an app store, then that’s when PhoneGap makes a lot of sense.”

And one further reason it makes sense lies in its origins: it was created by developers, for developers, to fix a real-world problem.


We realised we could code once then deploy to three platforms. From there it just snowballed

LeRoux sets the scene. “When the iPhone was released, it hit like ton of bricks,” he recalls. “We realised this was the future of the web and we wanted to get involved.”

Yet when the iOS SDK came out in summer 2008, Nitobi’s team of developers struggled with it. “We looked at it and we were like: ‘Holy shit, Objective-C!’” LeRoux admits.

So Nitobi sent two of its developers –Rob Ellis and Brock Whitten – to iPhoneDevCamp with the explicit goal of trying to figure out a way to bridge the WebView back to JavaScript and native code. There they met Eric Oesterle and the original hack became a reality.

“We started reading into it and then we realised that we could call JavaScript from Objective-C, which is a pretty powerful idea,” he explains. “But we couldn’t call back out.

“Eventually, though, these three dudes found a hack where they could go through the URL, and they could intercept a call through the URL from the native code and use that to call dynamically any native code they wanted.”

Triumphant, they returned to Nitobi giddy with excitement, says LeRoux. “They had a little sprite of Super Mario they could boot around on screen that was in the accelerometer,” he laughs. “This was a big deal because it was a web page. And web pages didn’t have an accelerometer at the time.”

Then, thanks to a little intra-office rivalry, things started to get interesting. “One of our other devs Joe Bowser, a hardcore Android guy, was like: ‘I could do this in Android’. And he managed to put together a prototype within a week. Then, not to be outdone Dave Johnson, our CTO at the time, who was in love with his BlackBerry, put together a prototype on that. And that was when we realised we had something we could use to write code once then deploy to three platforms. From there it just snowballed.”

When Nitobi open-sourced the project on GitHub, it blew up. “That was a big catalyst for us,” says LeRoux, “because it made the barrier for contributions pretty much zero. Tons of people gravitated towards to the project.”

Next steps

Brian LeRoux

A year later, the company was going from conference to conference, training people to use PhoneGap. But a big headache remained.

“It would take three or four hours to get people rolling,” recalls LeRoux. “And it wasn’t because they weren’t good programmers. It was just because it’s a huge pain in the ass to set up all these SDKs.”

So to speed things up, Nitobi created PhoneGap Build, a cloud service built on top of PhoneGap that enables you to start building your app straight away without having to download anything. (It’s currently in public beta and is free for one private app and an unlimited number of open source apps.)

All was going well. But suddenly the open source community drew a sharp intake of breath. Adobe had taken over Nitobi.

Corporate takeover

“When the founders discovered that Adobe was interested in us, in the summer of 2011, it was a shock,” admits LeRoux.

But the web giant was keen to put minds at rest. “They came to all of us, and we all talked about it, and it was like a big group therapy session,” he smiles.

“We’d thought of Adobe as this company that created Flash, was like an older generation web company, somewhat enterprise-y, and really not a huge player in the new generation of open source,” explains LeRoux. “So those were all big concerns for us.

“But we talked it through, and it turned out they were building a kick-ass WebKit team, and were heavily involved in the Apache Software Foundation, and part of what they wanted us to do was continue the open source momentum of PhoneGap. So all those concerns were pretty much immediately addressed.”

As things move forward, PhoneGap itself will continue to be open source; PhoneGap Build, which includes proprietary code, will be how Adobe monetises its acquisition. But in practical terms, how have Nitobi and PhoneGap benefited from the new relationship?

“Well, before the day of the acquisition we were 23 people,” replies LeRoux. “Of those, we would have four at any one time working on the open source project. But the remaining members of the team would always be working on consulting arrangements. That’s how we made our money. Post-Adobe, the entire team is now dedicated to the open source project. So PhoneGap has had a huge boost of manpower.”

Of course, there are many other organisations involved in contributing to PhoneGap, including IBM, Microsoft, RIM and Nokia. “But now Adobe is chipping in a whole lot more people, these other companies are interested in contributing more too,” enthuses LeRoux.

Seeds of destruction

As the offline story gets better, these app stores are going to fade away

The future looks bright, then, for PhoneGap. Or does it? To the contrary, LeRoux stresses, PhoneGap’s ultimate future lies in its own destruction.

“The original vision – and this is something I would catch shit for, although I would say it anyway – is that the purpose of the PhoneGap project is for PhoneGap to cease to exist,” LeRoux explains. “We believe that the web should be a first-class platform, and so this is a goal of PhoneGap, to provide a reference implementation for browsers. And it’s working.

“We implemented geolocation before any of the mobile browsers did. And accelerometers. And all of these other device APIs, these things that are truly cross-platform.

“As the offline story gets a little bit better, these concepts of app stores are going to fade away,” LeRoux predicts. “Because everyone will be writing interoperable web apps that are hosted wherever the hell they want. Google and Mozilla of course are prototyping these ideas using cache manifest and their open web app store concepts. So definitely we’re going to have a future where PhoneGap isn’t needed.”

Thank you for reading 5 articles this month* Join now for unlimited access

Enjoy your first month for just £1 / $1 / €1

*Read 5 free articles per month without a subscription

Join now for unlimited access

Try first month for just £1 / $1 / €1

The Creative Bloq team is made up of a group of design fans, and has changed and evolved since Creative Bloq began back in 2012. The current website team consists of seven full-time members of staff: Editor Georgia Coggan, Deputy Editor Rosie Hilder, Deals Editor Beren Neale, Senior News Editor Daniel Piper, Digital Arts and Design Editor Ian Dean, Tech Reviews Editor Erlingur Einarsson and Ecommerce Writer Abi Le Guilcher, as well as a roster of freelancers from around the world. The 3D World and ImagineFX magazine teams also pitch in, ensuring that content from 3D World and ImagineFX is represented on Creative Bloq.