Converted plugin for cordova 3.x+