Just in case you have the same problem as me, I didn't know is needed to include the cordova.js script in your index.html, you don't have to provide the file or the reference, just include this line:
and then Cordova will use the library when compiling, after that the event is dispatched.