Porting for original Phonegap plugin for cordova 3.0