Sam Croft

Full-stack developer

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

  • 13 comments

Filed in: android, apps, cordova, iOS, jQuery, PhoneGap

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

  • 101 comments

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

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

  • 195 comments

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

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

  • 11 comments

Filed in: android, iOS, jQuery, PhoneGap

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…)

Building an Android PhoneGap app ‘reveal’ menu/tabbar that doesn’t rely on the use of position: fixed

  • 11 comments

Filed in: android, jQuery, PhoneGap

Last month I started developing for Android for the first time, using PhoneGap and Eclipse. Initially this was a bit of shock, I was rather outside of my comfort zone having used Xcode and iOS for the last three months.

After packing away my lovely iPhone 4 test phone and pulling out the ol’ HTC Desire I went through the laborious process of setting up an Android development environment—slightly more confusing than installing Xcode, but once set up there is none of the certificate bullshit to slow you down. Yippee.

(more…)