Please see github.com/phonegap/phonegap-plugins/wik... I think that this should help.
Your problem is that cordova is not defined. Make sure your cordova. Js is actually being loaded and that it's loaded prior to this plugin you are creating.