Episode 26

Wednesday, January 11, 2012
  • PhoneGap for Qt

Mark Hatch and Jeff Tranter

Intro:  Welcome to Integrated Computer Solution’s, This Week in Qt, the podcast that keeps you informed of significant events that may impact your engineering projects. If you have not yet heard about ICS, please visit our website at www.ics.com. As an organization, we believe we have the best independent team of Qt engineers in the world. Whether you're starting a new project or need help solving a Qt development challenge, please contact us at sales@ics.com.

Mark:  Hello, this is Mark Hatch from Integrated Computer Solutions.  I run the Qt business here at ICS, and this week in Qt we get a chance to talk to Jeff Tranter, who is up in our Ottawa office.  And he runs our consulting business up there.  Today we are going to be talking about PhoneGap.

So Jeff, why don’t you tell me, what is PhoneGap? 

Jeff:  Sure.  Hello, everyone.  PhoneGap is a development framework for mobile web applications.  What it is, is it allows developers to natively target different smartphone platforms with the same application codebase.  And to do this it leverages HTML5, which means that you write your application in JavaScript, HTML and CSS, and with PhoneGap you can wrap your application in a native application and then run that on different platforms with essentially the same codebase.  So PhoneGap exposes the different platform-specific features to JavaScript, and then it runs your application in a webview natively on each of the platforms.   

M:  So our Qt listeners should see the concept which is, you write HTML5 once, and then PhoneGap provides the basic glue for each of the smartphones to get at things like GPS or other device-local capabilities, correct?

J:  Right, so it’s really a great option for doing cross-platform development.  It’s not the only solution, but it’s definitely a popular option if you want to do cross-platform development on different types of mobile development platforms. 

M:  And one of the great things, right, is that it works on iOS, Apple’s iPhone operating system as well as Android and other platforms, right?

J:  Right, it currently has good support for iOS, iPhones, Android, and Windows Phone 7, and there’s partial support currently for the different BlackBerry OS’s, WebOS, Samsung’s bada, and Nokia’s Symbian platform.   

M:  That’s pretty cool.  So is this open-source, or is this proprietary?  What is this software? 

J:  It is open-source.  It is licensed under the Apache license.  Originally PhoneGap was developed by a company called Nitobi software, and back in October of last year they were purchased by Adobe, presumably as part of Adobe’s recognition that HTML5 is going to be pretty big in the future.  So it’s now being developed as an open-source project under the auspices of the Apache software foundation.  And they are calling the open-source project Apache Cordova, although you may see references to Apache Callback which is a name that was being used for a few weeks until they picked a name.


M:  Ok, so what is ICS doing with PhoneGap?

J: So we are developing a Qt 5 port of PhoneGap. We’d like to see PhoneGap supported when Qt 5 comes out this summer, although we’d like to see a preview this Spring.  We’d like to see Qt 5 as one of the platforms that PhoneGap supports. We are doing this as an open-source project like the rest of PhoneGap, and we are leveraging an existing partial implementation for Qt 4 using that as a base, and the plan currently is to share the same codebase between Qt 4 and Qt 5, and backporting a lot of the work we do back to the Qt 4 version as well.

M:  So who’s going to get the benefit of this?  What’s the “so what” here?   

J:  Well, looking internally at ICS, we’ve found it challenging to develop mobile applications for different platforms.  We’ve found that you often have to rewrite the application for every platform if you are going to go totally native.  So we’ve really recognized PhoneGap as one of the strategies you can use for cross-platform mobile applications.  So for us, we can see it helping with development of mobile applications that we do internally, and ones that we write for our customers.  But, we’re also seeing HTML5 as kind of a big industry trend these days.  If you look for example at the Tizen platform, which this week just released it’s first preview, and it’s using HTML5 as its preferred format for applications.  So we’d like to see Qt 5 be a great platform for HTML applications and I think this is one way that we can bring Qt closer to some of the mainstream mobile developers who might have not really considered Qt as a native toolkit.             

M:  So, the summary here is that in addition to providing a way for people to write mobile applications that target additional platforms, the Qt ecosystem should applaud this work because it really helps promote the use of Qt in more platforms.  It sounds really exciting.

  Ok.  So Jeff, I think the question that our listeners want to know is how do I use PhoneGap?

J:  Right.  Well, the way you use it is specific to each platform.  As I mentioned it provides a native wrapper application with a webview embedded in it for your HTML5 code.  So you typically will take the SDK for each platform you are using, and compile and package and then test your application.  For example, on Android you use the Eclipse-based Java IDE to build the application, package it, and test it.    

M:  Ok, so where are we now?  What is the current status of your effort?

J:  The Qt version provides a wrapper that uses a Qt webview that loads the users HTML5 application into it.  So, we essentially get some of the PhoneGap functions for free because they follow the HTML5 standard and they are built into WebKit.  So that would be things like video and audio support, and geolocation.  And the other API’s that PhoneGap defines, we implement those on top of Qt’s mobility functions, either Qt Mobility on Qt 4 or in Qt 5 these are just optional Qt modules that provide mobility functions.  So we’ve initially ported the existing Qt 4 version to run on Qt 5 and just now moved on to implementing some of the additional API’s like the compass and the accelerometer.      

M:  Ok, so if somebody went to the site and grabs the Tarball, what are they going to see?  What works right now?

J:  Right now there is a repository in Git and it will build on Qt 5, and some of the functions are working, and you can run it under the Qt simulator, or if you have a device that’s running Qt4 or Qt 5, you can build it and run it on that device.  We have used a Nokia N9 for example.

M:  Ok, so we actually have it running on an N9 as a test platform.  

J: That’s right. With Qt 4 at the moment, but one of the next steps is to get Qt 5 up and running on an N9, which people have done.

M:  I know you guys are writing a blog which updates everyone; do you have instructions on how to build Qt 5, or any secrets on how to do that on the blog?

J:  We do.  We’ve referenced some pretty good instructions on how to build Qt 5 from Git.  We’ve also added to that a few tips that we’ve found as we’ve been building it, and particularly building the most recent WebKit under Qt 5. So we pick up all the recent WebKit enhancements.

M:  So what’s been some of the challenges so far in getting this working?

J:  Well the big thing is that Qt 5 is still in pretty rapid development.  It’s not released, so you are working on code in Git that’s changing daily.  The good news is that we should be seeing a feature freeze probably next month that will start stabilizing the API’s, and there should be some kind of a preview release this spring before we get into betas, and maybe the final release hopefully this summer.  Other issues are that Qt 5 and WebKit are huge source code bases with all the different modules, particularly WebKit, so it takes some time to download and compile those. Also, the Qt simulator which is a really nice tool on Qt 4 where you can simulate a lot of the phone functions, that’s not available yet ported to Qt 5, so we aren’t yet able to leverage that with the Qt 5 builds.  Obviously there aren’t any commercial devices running Qt 5 yet, but it’s possible to get Qt 5 running on a Nokia N9 or a N950 and there are instructions out there showing how people have done that.  Fortunately, the differences between Qt 4 and 5 are not too major.  They certainly are not to the same extent as the changes back between Qt 3 and 4 which developers had to deal with a few years back. So, we’re really not looking at a huge porting effort from the source code level.

M:  So, does the Raspberry Pi initiative have anything to do with what you are up to?

J:  We are actually planning to use one of these inexpensive $35 Raspberry Pi boards as one of the hardware platforms for the project.  It’s not a phone, but it looks like it’s going to be a very low-cost platform that will have a good solid port of Qt 5.  So it will give us a good testbed for running the code we’re developing on real embedded hardware, and I think that it’s also likely that some of the end-users of the Raspberry Pi boards will probably want to run HTML5 apps, so there should be some benefits to getting PhoneGap up and running on it as well.

M:  Well, that’s great.  So how can other people participate?  Where should they go to look at what’s going on, and how do they join the team?

J:  So it’s an open-source project and we welcome help from other people, not just developers but anyone who is willing to help with testing or writing documentation.  And if you are a developer, you don’t necessarily have to be a Qt developer; you could be a web developer with JavaScript experience.  We could definitely use that.  So there is a lot of information on our wiki page which is on the qt-project at wiki.qt-project.org.  The easiest thing to do is probably to look for PhoneGap under there.  We’re also reporting our progress on our blog which is at phonegap.ics.com.       

M:  And there is a link from there to the wiki?

J:  Yes there is.

M:  Ok great.  So this sounds really exciting.  I’m really happy that you were able to get with us and update us on this effort.  Do you have anything to add before we sign off? 

J:  I think this is going to be an exciting project.  It’s something a little different from the usual Qt development that we are doing, but it also leverages a lot of research and things we’ve been doing on HTML5, and kind of bringing together the two different worlds which hasn’t been done a lot in the past.  We’re excited about it and definitely welcome any other developers that want to contribute to the project.     

M:  Great Jeff, thank you very much for updating us. For ICS, this is Mark Hatch and Jeff Tranter signing off. Thank you.