Updated to work with phonegap 3.0