Phonegap 3.1 support

Got it all working