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 mon problem. Here's the plugins in the config.xml
file:
<!-- Plugins -->
<gap:plugin name="org.apache.cordova.device" /> <!-- Device plugin -->
<gap:plugin name=".phonegap.plugin.statusbar" /> <!-- Status bar plugin -->
<gap:plugin name=".verso.cordova.clipboard" /> <!-- Clipboard plugin -->
<gap:plugin name=".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)
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 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 mon problem. Here's the plugins in the config.xml
file:
<!-- Plugins -->
<gap:plugin name="org.apache.cordova.device" /> <!-- Device plugin -->
<gap:plugin name=".phonegap.plugin.statusbar" /> <!-- Status bar plugin -->
<gap:plugin name=".verso.cordova.clipboard" /> <!-- Clipboard plugin -->
<gap:plugin name=".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.)
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.
Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Nov 9, 2013 at 8:07 Youssef MoawadYoussef Moawad 2,8655 gold badges31 silver badges50 bronze badges 6- You need to do the following steps: 1. android plugin in native code (Android plugin) 2. html part for call function 3. write js function to call native code 4. configure plugin in config.xml where is your android native code. if you provide others can see thats the problem. see sample for how to use android plugin in the below link: stackoverflow./questions/19721772/… – power_scriptor Commented Nov 9, 2013 at 9:02
- @power_scriptor I am not using PhoneGap locally... I am using PhoneGap Build and so I don't maintain native APIs and I can't write native code. All these plugins are plugins provided in the PhoneGap Build Plugins page. Also I am building for all platforms not just Android. – Youssef Moawad Commented Nov 9, 2013 at 11:37
- You should post your entire index.html page and config.xml, all the above code looks fine, so it must be somewhere else. – Red2678 Commented Nov 9, 2013 at 16:15
- PS - can you get an alert after "deviceready" fires? – Red2678 Commented Nov 9, 2013 at 16:18
- @Red2678 sorry for being late, the website was down. The deviceready event DOES fire! I do get the alert. Also my index.html page is empty as all elements are inserted through jQuery. – Youssef Moawad Commented Nov 10, 2013 at 6:49
2 Answers
Reset to default 3I was able to fix this by realizing that I had made a mistake in config.xml
file:
This: xmlns:gap = "http://phonegap./ns/1.0"
was xmlns:gap = "http://phonegap./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.
Put the config.xml in the www directory. And then upload only www.zip on build.phone..
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745130212a4612933.html
评论列表(0条)