So you are using the TouchKit archetype? By default, it puts a the Vaadin application into an iframe, Cordova is not accessible inside the iframe. There are two options:
Disable iframe (a parameter in index.html). Not sure which issues there might be, but apparently it was created to solve some problems with offline-mode.
Use web messages to delegate PhongGap calls from and to iframe.
I tried the 1) option, but unfortunatley due to cordova changes this triggers infinite refreshing of the page. The vaadin team is aware of the issue and is working on a solution.
How exactly would 2) work? What I require to do is for example activate the Barcode scanner of cordova while the app is running.
If you could give me a simple example on how to call a cordova function on a button press it would be very helpfull!
There is an example in the article that I linked in the previous post. Messages to iframe:
function sendMessage(msg) { iframe.contentWindow.postMessage("cordova-" + msg, "*"); }
Then you have to set a listener inside the iframe to listen to message events. You can also send messages to the main window.
$wnd.parent.postMessage(msg,'*');
It’s not complex, but requires some coding. Not optimal if you need to access a lot of phonegap’s functionality, but sometimes there’s no other choice.