PhoneGap: nearly there – but not quite

PhoneGap: nearly there – but not quite 1280 706 Morten Jensen

A while back I wrote about an internal proof of concept we were doing in order to port our app to Android using PhoneGap. The exercise was time boxed to about 2-3 weeks and was carried out by 2 of our developers. The focus was on the Privacy section where users can review terms of service meanings and ratings for many services; including Facebook, Twitter and Google.

We feel that it is important to provide a rich and easy-to-use user interface for Terms of Service with simple explanations that bridge the gap between the legalese and users of the services. Terms of Service are often so long and construed that virtually no-one bothers reading them. This leads to a lack of understanding of the implications of signing up to – and using – the services. For instance, who owns the content you post and what license do you implicitly give to the service regarding the content that you post?

The overall outcome of the proof of concept was not bad – but due to our mirror/lens user interface in the privacy section, performance & response was too slow in this particular area, which introduced unacceptable risk for the suitability and uptake of the end-result. Ironically, the user interface ran quite well on iOS 7+ – but performance on a variety of Android devices was abysmal.

To render the privacy screen with mirrors and lenses we chose famo.us, which is a very promising layout and rendering engine built on JavaScript and CSS, which can render to DOM, Canvas, or WebGL. I say promising, because if the performance issues on Android can be resolved (and we may only be months away – see below) then there’s little doubt in my mind that it would be suitable for our purpose.

It would appear that others have had similar experiences with PhoneGap on Android in general. famo.us has, in fact, for this reason promised to build a better PhoneGap. We’re therefore waiting with bated breath – and we will continue to monitor development in this area as we may well make the switch in the future.

Unfortunately, the show must go on – and we are therefore currently busy porting our app to Android natively. We are expecting an Android release later this year.

We have in the meantime open sourced the proof of concept on GitHub(Apache License, Version 2.0). We have also included the report that was written up by our lead app developer Lennie (30/06/2014). We are hoping to spur on a discussion in the wider community about PhoneGap (Apache Cordova) use for cross-platform development and we would value any input you may have. Please feel free to post comments in our CitizenMe forum – or to contact me by email in this regard: morten at citizenme.com.

Report

Overview:

Creation of the Mirror and Lenses using PhoneGap (http://www.phonegap.com) with Apache Cordova (http://cordova.apache.org) to target iOS and Android.

Goal is to see the performance etc to decide if PhoneGap technology is suitable for Development of the complete CitizenMe application to target multiple mobile platforms (Android, FireFox OS, Ubuntu Touch etc) and use the same code on the browser (Internet Explorer, Firefox, Chrome).

Technology:

PhoneGap: http://www.phonegap.com

Apache Cordova: http://cordova.apache.org

Famo.us: http://famo.us

Language: JavaScript, HTML 5, CSS

Using Famo.us to build the tab bar navigation and the Mirror + Lenses.

Tested Platforms:

We only tested the POC on iOS, Android and FireFox OS devices.

On iOS and Firefox OS there is a little delay in the speed but on the Android application the speed is poor.

TypeScript:

Looked into using TypeScript language (http://www.typescriptlang.org) as a layer above JavaScript where you code the back-end logic in TypeScript.

Found that TypeScript is a good fit but didn’t use it in the POC since no definitions were available for Famo.us.
Famo.us:

Famo.us promises to allow web developers to tap the GPU of a device (be it that of a computer, smart TV, tablet, or a phone) for calculations, no plug-in required. To the developer, that means being able to build interfaces that are simultaneously richer and faster. To the end user, that means user interfaces with faster, smoother animations without having to install any plug-ins.

Building apps with Famo.us is certainly possible but there are some pitfalls to consider. Firstly Famo.us is a new framework and therefore lacks many essential building blocks that more established frameworks offer.

Developers utilise many such building blocks in the application development lifecycle. View-management, ready-made UI components, established libraries to accomplish a myriad of tasks such as networking communications, json serialization, etc.

On the plus side, Famo.us can be combined with other frameworks such as jQuery to help with common development tasks.

The main issue at this point in time however, is the lack of support and a non-existent community to assist a developer when a question needs to be answered or a problem needs to be resolved.

Performance:

PhoneGap / Cordova framework with JavaScript doesn’t perform the same as native technology since it is limited to the web browser function of the device especially Web Kit implementation. You will see major differences between WebKit on iOS vs WebKit on Android.

On native platforms the code / application runs close to the hardware, CPU etc where PhoneGap code is interpreted within a web browser window.

Photo credit: Negative Space

Leave a Reply

Your email address will not be published.