I am building a PhoneGap Build app and I will be requiring some plugins. I have followed the docs yet none are working. Since none of them are working I suppose it's a common problem. Here's the plugins in the config.xml
file:
<!-- Plugins -->
<gap:plugin name="org.apache.cordova.device" /> <!-- Device plugin -->
<gap:plugin name="com.phonegap.plugin.statusbar" /> <!-- Status bar plugin -->
<gap:plugin name="com.verso.cordova.clipboard" /> <!-- Clipboard plugin -->
<gap:plugin name="com.chariotsolutions.cordova.plugin.keyboard_toolbar_remover" /> <!-- Keyboard toolbar removal plugin -->
<gap:plugin name="org.apache.cordova.splashscreen" /> <!-- Splashscreen plugin -->
<gap:plugin name="org.apache.cordova.vibration" /> <!-- Vibration plugin -->
Here's the links in the index.html
file (if there's a problem my best guess is that it will be here):
<!-- PhoneGap Build -->
<script src="phonegap.js"></script>
<script src="device.js"></script>
<script src="statusbar.js"></script>
<script src="clipboard.js"></script>
<script src="keyboard_toolbar_remover.js"></script>
<script src="splashscreen.js"></script>
<script src="vibration.js"></script>
None are working except the device plugin (firing the 'deviceready' event).
Here's some code from the javascript file:
document.addEventListener("deviceready", function(e) {
// Hiding the status bar as even the fullscreen preference in config.xml isn't working
StatusBar.hide();
window.setTimeout(function() {
// Trying to hide the splash screen which also doesn't work (or even show) properly from config.xml
navigator.splashscreen.hide();
}, 4000);
}, "false");
I tested this function with an alert and I can assure you that it does get called. Here's some more:
// This is for the clipboard plugin
function handleCopyAndPaste() {
$(".copyButton").click(function() {
window.plugins.clipboard.copy($("#result").val());
});
$(".pasteButton").click(function() {
window.plugins.clipboard.paste(function (text) {
$("#convertThis").val(text);
convert();
});
});
}
This is for vibrations:
navigator.notification.vibrate(2500);
This is for hiding the keyboard toolbar once an input field called #convertThis
has focus()
:
$("#convertThis").focus(function() {
toolbar.hide()
});
I tried removing the js links in index.html
yet still nothing. I also tried putting the plugin tags outside the widget tag in config.xml
and... NOTHING! Weirdly enough, the plugins tab in PhoneGap Build dashboards says none are installed:
(source: uzusoft.com)
If you can provide any help on the matter, please do! Also on the config.xml issues please.
UPDATE: I am currently using PhoneGap Build 3.1.0 is order to support iOS 7.
I was able to fix this by realizing that I had made a mistake in config.xml
file:
This: xmlns:gap = "http://phonegap.com/ns/1.0"
was xmlns:gap = "http://phonegap.com/ns/3.1.0"
as I thought this was necessary to use Cordova 3.1.0 but it doesn't really have anything to do with it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With