I'm writing my first PhoneGap app, and I need to make the keyboard appear and disappear programmatically. Unfortunately, it's not working, but I wonder if I'm doing it correctly. Here's the state of things:
I used $ cordova plugin search keyboard
to find this plugin at the command line, and then I installed it like this:
$ cordova plugin add org.apache.cordova.plugin.softkeyboard
Fetching plugin "org.apache.cordova.plugin.softkeyboard" via plugin registry
Installing "org.apache.cordova.plugin.softkeyboard" for android
Based on another SO answer, I then added this line to my config.xml:
<plugin name="SoftKeyBoard" value="org.apache.cordova.plugin.SoftKeyBoard" />
I put softkeyboard.js in myapp/www/js/, and I referenced it in the html like so:
<script type="text/javascript" charset="utf-8" src="js/softkeyboard.js"></script>
After installing, SoftKeyboard.java appeared in myapp/plugins/org.apache.cordova.plugin.softkeyboard . But just for good measure I also put a copy in myapp/src/org/apache/cordova/plugin/ .
Finally, I added these to my html:
<button id="keyboard">Toggle Keyboard</button>
and
<script>
var softkeyboard = window.cordova.plugins.SoftKeyBoard;
$('#keyboard').toggle(softkeyboard.show, softkeyboard.hide);
</script>
As you might have guessed, nothing happened when I rebuilt and clicked the button. What should I be doing differently?
Thanks!
P.S. - After seeing plugin (singular) and plugins (plural) used in so many SO answers, I renamed everything both ways and that didn't affect the outcome.