Updated for phonegap 3.0