Sam Croft

Full-stack developer

Quick tip: using HTML5 localstorage to store JSON objects on a device in your PhoneGap app

  • 66 comments

Filed in: android, Cordova, iOS, javascript, JSON, PhoneGap, Uncategorized

I’ve written a couple of articles about loading remote data into PhoneGap apps (sans framework), but I haven’t mentioned a good little method of storing that data on the device so you don’t need to request it from a server again. This is a quick tip for how you can do that.

Of course, it depends on the type of data that you are loading from your server in the first place. You wouldn’t necessarily want to store data that would be out of date quickly – such as share prices or live sports scores. But there will certainly be times when you want to save the data you’ve just loaded for use at a later time, without having to load it again.

(more…)

My article for Adobe's Appliness magazine: Loading data into, and posting data from, a PhoneGap app

  • 53 comments

Filed in: android, apps, Cordova, iOS, jQuery, JSON, MySQL, PhoneGap, php, Uncategorized, zepto

In September we tweeted a photo at RITH of a PhoneGap app we’d been working on. The photo showed the app running on quite a few iOS and Android phones and an iPad. One HTML5 app, running perfectly on many devices, all with different resolutions and pixel densities.

UniApp running on iPhone and Android phones and an iPad

Following a retweet by PhoneGap we were contacted by Adobe’s new magazine, Appliness, to see if we’d like to write an article for their October issue. I jumped at the chance.

(more…)

Responsive button feedback in PhoneGap apps: a better alternative to -webkit-tap-highlight-color

  • 24 comments

Filed in: android, apps, Cordova, css, iOS, PhoneGap, Uncategorized, zepto

I don’t think I’m alone when I say that the most important thing with a PhoneGap app is that it feels responsive to a users touch. It goes without saying that the easiest argument that web/hybrid app neigh-sayers have is touch response lag. The first thing they’re going to point fingers at and tweet to their native compadres is how many milliseconds it takes for a button to light up when it is touched.

(more…)

How to elegantly handle errors in a PhoneGap app by using device API native notifications

  • 26 comments

Filed in: android, apps, Cordova, iOS, jQuery, PhoneGap, Uncategorized

Making use of the device API is what makes PhoneGap so brilliant. What’s equally brilliant is how simple it is to integrate some of these functions within your app.

One of these functions is the native notification which can be used in place of, or in addition to, any error messages that you might need to display in your app.

(more…)

Posting data from a PhoneGap app to a server using jQuery

  • 188 comments

Filed in: android, forms, iOS, jQuery, MySQL, PhoneGap, php, Uncategorized

Recently I’ve had several requests to create an article about posting data to a server from a PhoneGap app so I thought I’d cover the steps I go through when dealing with this kind of requirement.

The method is extremely simple providing a few important steps are followed.

(more…)

Updated: loading external data into an iOS PhoneGap app using jQuery 1.5

  • 371 comments

Filed in: iOS, jQuery, JSON, MySQL, PhoneGap, php, Uncategorized

Update: Following the release of PhoneGap 1.0 and XCode 4 I have updated the Git repository to include a version built with PhoneGap 0.9x (the original version) and a separate version for PhoneGap 1.xx+.

Update: Due to some issues with the recent versions of Cordova I have updated the Git repository to also include a version built with Cordova 1.7.0.

My 2010 post about loading data into a PhoneGap application is by far the most viewed page of my blog so I thought I’d revisit it and write an article about a more efficient method I have been using, following the release of jQuery 1.5.

Previously I had been using the wonderful JSONp jQuery plugin because jQuery 1.4 and lower did not support out of the box error handlers for JSON requests. jQuery 1.5 does, however, and it’s made things simpler and more streamlined.

(more…)

A super-lightweight mobile webkit accordion jQuery plugin, great for iOS/Android PhoneGap apps

  • 16 comments

Filed in: android, iOS, jQuery, PhoneGap, Uncategorized

Ahhh, accordions. Their use and acceptance in web design has been varied over the years, but right now I think we can safely say they are en vogue. Unfortunately, as developers (myself included), when we use an accordion we probably use the same old chunk of code and non-semantic tag-soup that we used last season. And the time before that.

For about a year I’ve been meaning to write my own lightweight accordion that we can use across the board on our various projects at RITH. And at the moment, that largely entails creating reusable webkit optimised code for use on iOS and Android mobile devices deployed as native apps using PhoneGap.

(more…)