Monday, 16 July 2012

PhoneGap + processing.js = big problems

This is less a 'code solution' than it is a code issue, in that I don't know how to fix it and abandoned the solution.  I will likely go back and attempt to resolve at some point, but for now I just want to tell you about what I'd wanted to create, what the issues were and how it caused my PhoneGap app to be labelled as "sucks!!!!"

As I previously blogged this solution, I figured I should also share these issues

The problem

I wanted to be able to create cross-platform mobile applications whilst not having to do it in Javascript.  I've never liked Javascript, I'm not really sure why, maybe I don't fully understand it.

The solution

I had a brainwave that I could create a functional Java application using Processing (that I have used a lot and, hopefully, will be contributing author to a book on the subject if it ever gets published), port it to processing.js and deploy that as an Apache Cordova (PhoneGap) based mobile application.  As a short explanation, Apache Cordova is a cross-platform framework for writing and deploying HTML5 apps to most mobile platforms.  Processing is a graphical Java-based library of which processing.js is the Javascript equivalent.  Using both processing.js and Cordova, I should be able to deploy a java-based application into a cross-platform framework and run it as javascript Ideal. I thought

The issue(s)

Porting the Java-based Processing application to processing.js wasn't as easy as it appeared due to limitations/differences between Java and Javascript (such as variables and methods being public). I also needed to rewrite some code due to limitations with processing.js (such as there being no enum support). However, after some trial and error I was able to get it running in a desktop browser, and it all seemed good

I managed to integrate the Java source with Javascript, so that at runtime the UI could call Javascript, and therefore Cordova, and initiate phone-specific functions.  One example being the phone's vibrate facility.  It was looking good

A BIG issue

Or at least it looked good to me.  I'd tested it on 2 phones, an HTC Sensation XE running Android 2.3 (Gingerbread) and a Samsung Galaxy Nexus running Android 4.0 (Ice-Cream Sandwich).  Unfortunately it didn't look good to other people 'in the wild'.  I started receiving Google Play reviews that my app "Sucks!!!!" because it either displayed a blank screen, or the buttons weren't clickable etc.  I was confused, maybe the users didn't realise they needed to click 'Start' I thought.  But the bad reviews rolled in

As I had limited devices, and resources, I posted on facebook asking my friends to install the app and let me know if they found any issues.  Someone did (thanks Che!). The app functioned ok for a bit, then seemed to freeze so they couldn't press any of the buttons.  Eventually, I did manage to reproduce this on one my phones - at random places the app would appear to freeze, though I could tell by the vibrate I'd added that it was still functioning, just the UI wasn't updating

I has a sad :(

As I was receiving poor reviews, I wanted to fix this FAST.  So I quickly reverted to a native Android app and redistributed it to Google Play.  The poor reviews have now stopped, but I haven't fixed the underlying issue.  Searching Google hasn't revealed anything, so I'm left with debugging this myself

For anyone interested in progress, my app can be seen on Google Play, bad reviews and all :(

I have a request for anyone reading this:  have you experienced this same problem? If you have, comment below or bung me an email on antony@weblore.eu. I'd be interested in your perspective

No comments:

Post a Comment